[PATCH 3/3] Fix a few compilation warnings.
Yousong Zhou
yszhou4tech at gmail.com
Sat Jan 31 08:10:08 PST 2015
Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
kexec/arch/mips/crashdump-mips.c | 3 ++-
kexec/arch/mips/kexec-elf-mips.c | 2 +-
kexec/kexec-elf-rel.c | 3 +++
kexec/kexec.h | 2 +-
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/kexec/arch/mips/crashdump-mips.c b/kexec/arch/mips/crashdump-mips.c
index e7840e0..98c9f7c 100644
--- a/kexec/arch/mips/crashdump-mips.c
+++ b/kexec/arch/mips/crashdump-mips.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
+#include <inttypes.h>
#include <elf.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -52,7 +53,7 @@ static int get_kernel_paddr(struct crash_elf_info *elf_info)
if (parse_iomem_single("Kernel code\n", &start, NULL) == 0) {
elf_info->kern_paddr_start = start;
- dbgprintf("kernel load physical addr start = 0x%lx\n", start);
+ dbgprintf("kernel load physical addr start = 0x%" PRIu64 "\n", start);
return 0;
}
diff --git a/kexec/arch/mips/kexec-elf-mips.c b/kexec/arch/mips/kexec-elf-mips.c
index a27d986..8a6419a 100644
--- a/kexec/arch/mips/kexec-elf-mips.c
+++ b/kexec/arch/mips/kexec-elf-mips.c
@@ -158,7 +158,7 @@ int elf_mips_load(int argc, char **argv, const char *buf, off_t len,
if (info->kexec_flags & KEXEC_ON_CRASH)
/* In case of crashdump segment[0] is kernel.
* Put cmdline just after it. */
- cmdline_addr = info->segment[0].mem +
+ cmdline_addr = (unsigned long)info->segment[0].mem +
info->segment[0].memsz;
else
cmdline_addr = 0;
diff --git a/kexec/kexec-elf-rel.c b/kexec/kexec-elf-rel.c
index c625f30..5a5fcd1 100644
--- a/kexec/kexec-elf-rel.c
+++ b/kexec/kexec-elf-rel.c
@@ -347,6 +347,9 @@ int elf_rel_load(struct mem_ehdr *ehdr, struct kexec_info *info,
else if (shdr->sh_type == SHT_RELA) {
rel = elf_rela(ehdr, ptr);
}
+ else {
+ die("Unexpected sh_type: %d\n", shdr->sh_type);
+ }
/* the location to change */
location = section->sh_data + rel.r_offset;
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 4be2b2f..2c85052 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -245,7 +245,7 @@ extern int file_types;
extern void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr);
extern void die(const char *fmt, ...)
- __attribute__ ((format (printf, 1, 2)));
+ __attribute__ ((format (printf, 1, 2), noreturn));
extern void *xmalloc(size_t size);
extern void *xrealloc(void *ptr, size_t size);
extern char *slurp_file(const char *filename, off_t *r_size);
--
1.7.10.4
More information about the kexec
mailing list