* [PATCH 1/3] configure.ac: quote result of AC_CHECK_LIB()
@ 2015-01-31 16:10 Yousong Zhou
2015-01-31 16:10 ` [PATCH 2/3] Fix zlib/lzma decompression Yousong Zhou
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Yousong Zhou @ 2015-01-31 16:10 UTC (permalink / raw)
To: kexec; +Cc: Yousong Zhou, horms
Fix the following error when searching for lzma support.
checking for lzma_code in -llzma... ./configure: line 4756: ac_fn_c_try_link: command not found
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
configure.ac | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4e15cb0..212e838 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,22 +152,22 @@ AC_CHECK_PROG([DIRNAME], dirname, dirname, "no", [$PATH])
dnl See if I have a usable copy of zlib available
if test "$with_zlib" = yes ; then
AC_CHECK_HEADER(zlib.h,
- AC_CHECK_LIB(z, inflateInit_, ,
- AC_MSG_NOTICE([zlib support disabled])))
+ [AC_CHECK_LIB(z, inflateInit_, ,
+ AC_MSG_NOTICE([zlib support disabled]))])
fi
dnl See if I have a usable copy of lzma available
if test "$with_lzma" = yes ; then
AC_CHECK_HEADER(lzma.h,
- AC_CHECK_LIB(lzma, lzma_code, ,
- AC_MSG_NOTICE([lzma support disabled])))
+ [AC_CHECK_LIB(lzma, lzma_code, ,
+ AC_MSG_NOTICE([lzma support disabled]))])
fi
dnl find Xen control stack libraries
if test "$with_xen" = yes ; then
AC_CHECK_HEADER(xenctrl.h,
- AC_CHECK_LIB(xenctrl, xc_kexec_load, ,
- AC_MSG_NOTICE([Xen support disabled])))
+ [AC_CHECK_LIB(xenctrl, xc_kexec_load, ,
+ AC_MSG_NOTICE([Xen support disabled]))])
fi
dnl ---Sanity checks
--
1.7.10.4
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] Fix zlib/lzma decompression.
2015-01-31 16:10 [PATCH 1/3] configure.ac: quote result of AC_CHECK_LIB() Yousong Zhou
@ 2015-01-31 16:10 ` Yousong Zhou
2015-02-09 6:00 ` Simon Horman
2015-01-31 16:10 ` [PATCH 3/3] Fix a few compilation warnings Yousong Zhou
2015-02-09 5:56 ` [PATCH 1/3] configure.ac: quote result of AC_CHECK_LIB() Simon Horman
2 siblings, 1 reply; 8+ messages in thread
From: Yousong Zhou @ 2015-01-31 16:10 UTC (permalink / raw)
To: kexec; +Cc: Yousong Zhou, horms
Let {zlib,lzma}_decompress_file() return NULL if anything wrong happened
to allow the other method to have a chance to run.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
kexec/lzma.c | 33 ++++++++++++++++++++++-----------
kexec/zlib.c | 57 +++++++++++++++++++++++++++++++++++----------------------
2 files changed, 57 insertions(+), 33 deletions(-)
diff --git a/kexec/lzma.c b/kexec/lzma.c
index 939aeb3..5bfccb7 100644
--- a/kexec/lzma.c
+++ b/kexec/lzma.c
@@ -162,13 +162,16 @@ char *lzma_decompress_file(const char *filename, off_t *r_size)
off_t size, allocated;
ssize_t result;
- if (!filename) {
- *r_size = 0;
- return 0;
- }
+ dbgprintf("Try LZMA decompression.\n");
+
+ *r_size = 0;
+ if (!filename)
+ return NULL;
+
fp = lzopen(filename, "rb");
if (fp == 0) {
- die("Cannot open `%s'\n", filename);
+ dbgprintf("Cannot open `%s'\n", filename);
+ return NULL;
}
size = 0;
allocated = 65536;
@@ -183,17 +186,25 @@ char *lzma_decompress_file(const char *filename, off_t *r_size)
if ((errno == EINTR) || (errno == EAGAIN))
continue;
- die ("read on %s of %ld bytes failed\n",
- filename, (allocated - size) + 0UL);
+ dbgprintf("%s: read on %s of %ld bytes failed\n",
+ __func__, filename, (allocated - size) + 0UL);
+ break;
}
size += result;
- } while(result > 0);
- result = lzclose(fp);
- if (result != LZMA_OK) {
- die ("Close of %s failed\n", filename);
+ } while (result > 0);
+
+ if (lzclose(fp) != LZMA_OK) {
+ dbgprintf("%s: Close of %s failed\n", __func__, filename);
+ goto fail;
}
+ if (result < 0)
+ goto fail;
+
*r_size = size;
return buf;
+fail:
+ free(buf);
+ return NULL;
}
#else
char *lzma_decompress_file(const char *UNUSED(filename), off_t *UNUSED(r_size))
diff --git a/kexec/zlib.c b/kexec/zlib.c
index d44df12..7170ac3 100644
--- a/kexec/zlib.c
+++ b/kexec/zlib.c
@@ -15,29 +15,39 @@
#include <ctype.h>
#include <zlib.h>
+static void _gzerror(gzFile fp, int *errnum, const char **errmsg)
+{
+ *errmsg = gzerror(fp, errnum);
+ if (*errnum == Z_ERRNO) {
+ *errmsg = strerror(*errnum);
+ }
+}
+
char *zlib_decompress_file(const char *filename, off_t *r_size)
{
gzFile fp;
int errnum;
const char *msg;
char *buf;
- off_t size, allocated;
+ off_t size = 0, allocated;
ssize_t result;
+ dbgprintf("Try gzip decompression.\n");
+
+ *r_size = 0;
if (!filename) {
- *r_size = 0;
- return 0;
+ return NULL;
}
fp = gzopen(filename, "rb");
if (fp == 0) {
- msg = gzerror(fp, &errnum);
- if (errnum == Z_ERRNO) {
- msg = strerror(errno);
- }
- fprintf(stderr, "Cannot open `%s': %s\n", filename, msg);
+ _gzerror(fp, &errnum, &msg);
+ dbgprintf("Cannot open `%s': %s\n", filename, msg);
+ return NULL;
+ }
+ if (gzdirect(fp)) {
+ /* It's not in gzip format */
return NULL;
}
- size = 0;
allocated = 65536;
buf = xmalloc(allocated);
do {
@@ -49,25 +59,28 @@ char *zlib_decompress_file(const char *filename, off_t *r_size)
if (result < 0) {
if ((errno == EINTR) || (errno == EAGAIN))
continue;
-
- msg = gzerror(fp, &errnum);
- if (errnum == Z_ERRNO) {
- msg = strerror(errno);
- }
- die ("read on %s of %ld bytes failed: %s\n",
- filename, (allocated - size) + 0UL, msg);
+ _gzerror(fp, &errnum, &msg);
+ dbgprintf("Read on %s of %ld bytes failed: %s\n",
+ filename, (allocated - size) + 0UL, msg);
+ size = 0;
+ goto fail;
}
size += result;
} while(result > 0);
+
+fail:
result = gzclose(fp);
if (result != Z_OK) {
- msg = gzerror(fp, &errnum);
- if (errnum == Z_ERRNO) {
- msg = strerror(errno);
- }
- die ("Close of %s failed: %s\n", filename, msg);
+ _gzerror(fp, &errnum, &msg);
+ dbgprintf(" Close of %s failed: %s\n", filename, msg);
+ }
+
+ if (size > 0) {
+ *r_size = size;
+ } else {
+ free(buf);
+ buf = NULL;
}
- *r_size = size;
return buf;
}
#else
--
1.7.10.4
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] Fix a few compilation warnings.
2015-01-31 16:10 [PATCH 1/3] configure.ac: quote result of AC_CHECK_LIB() Yousong Zhou
2015-01-31 16:10 ` [PATCH 2/3] Fix zlib/lzma decompression Yousong Zhou
@ 2015-01-31 16:10 ` Yousong Zhou
2015-02-09 5:58 ` Simon Horman
2015-02-09 5:56 ` [PATCH 1/3] configure.ac: quote result of AC_CHECK_LIB() Simon Horman
2 siblings, 1 reply; 8+ messages in thread
From: Yousong Zhou @ 2015-01-31 16:10 UTC (permalink / raw)
To: kexec; +Cc: Yousong Zhou, horms
Signed-off-by: Yousong Zhou <yszhou4tech@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
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] configure.ac: quote result of AC_CHECK_LIB()
2015-01-31 16:10 [PATCH 1/3] configure.ac: quote result of AC_CHECK_LIB() Yousong Zhou
2015-01-31 16:10 ` [PATCH 2/3] Fix zlib/lzma decompression Yousong Zhou
2015-01-31 16:10 ` [PATCH 3/3] Fix a few compilation warnings Yousong Zhou
@ 2015-02-09 5:56 ` Simon Horman
2 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2015-02-09 5:56 UTC (permalink / raw)
To: Yousong Zhou; +Cc: kexec
On Sun, Feb 01, 2015 at 12:10:06AM +0800, Yousong Zhou wrote:
> Fix the following error when searching for lzma support.
>
> checking for lzma_code in -llzma... ./configure: line 4756: ac_fn_c_try_link: command not found
This change does more than the changelog suggests.
Please either update the change log or split the patch up.
> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
> ---
> configure.ac | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 4e15cb0..212e838 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -152,22 +152,22 @@ AC_CHECK_PROG([DIRNAME], dirname, dirname, "no", [$PATH])
> dnl See if I have a usable copy of zlib available
> if test "$with_zlib" = yes ; then
> AC_CHECK_HEADER(zlib.h,
> - AC_CHECK_LIB(z, inflateInit_, ,
> - AC_MSG_NOTICE([zlib support disabled])))
> + [AC_CHECK_LIB(z, inflateInit_, ,
> + AC_MSG_NOTICE([zlib support disabled]))])
> fi
>
> dnl See if I have a usable copy of lzma available
> if test "$with_lzma" = yes ; then
> AC_CHECK_HEADER(lzma.h,
> - AC_CHECK_LIB(lzma, lzma_code, ,
> - AC_MSG_NOTICE([lzma support disabled])))
> + [AC_CHECK_LIB(lzma, lzma_code, ,
> + AC_MSG_NOTICE([lzma support disabled]))])
> fi
>
> dnl find Xen control stack libraries
> if test "$with_xen" = yes ; then
> AC_CHECK_HEADER(xenctrl.h,
> - AC_CHECK_LIB(xenctrl, xc_kexec_load, ,
> - AC_MSG_NOTICE([Xen support disabled])))
> + [AC_CHECK_LIB(xenctrl, xc_kexec_load, ,
> + AC_MSG_NOTICE([Xen support disabled]))])
> fi
>
> dnl ---Sanity checks
> --
> 1.7.10.4
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] Fix a few compilation warnings.
2015-01-31 16:10 ` [PATCH 3/3] Fix a few compilation warnings Yousong Zhou
@ 2015-02-09 5:58 ` Simon Horman
2015-02-09 12:56 ` Yousong Zhou
0 siblings, 1 reply; 8+ messages in thread
From: Simon Horman @ 2015-02-09 5:58 UTC (permalink / raw)
To: Yousong Zhou; +Cc: kexec
These changes do not seem to be related to each other.
Please split this into 4 separate patches each with
a changelog that briefly describes what the problem is.
On Sun, Feb 01, 2015 at 12:10:08AM +0800, Yousong Zhou wrote:
>
> Signed-off-by: Yousong Zhou <yszhou4tech@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;
I wonder if we can resolve this without resorting to a cast.
> 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
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] Fix zlib/lzma decompression.
2015-01-31 16:10 ` [PATCH 2/3] Fix zlib/lzma decompression Yousong Zhou
@ 2015-02-09 6:00 ` Simon Horman
0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2015-02-09 6:00 UTC (permalink / raw)
To: Yousong Zhou; +Cc: kexec
On Sun, Feb 01, 2015 at 12:10:07AM +0800, Yousong Zhou wrote:
> Let {zlib,lzma}_decompress_file() return NULL if anything wrong happened
> to allow the other method to have a chance to run.
>
> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Thanks, applied.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] Fix a few compilation warnings.
2015-02-09 5:58 ` Simon Horman
@ 2015-02-09 12:56 ` Yousong Zhou
2015-02-10 0:14 ` Simon Horman
0 siblings, 1 reply; 8+ messages in thread
From: Yousong Zhou @ 2015-02-09 12:56 UTC (permalink / raw)
To: Simon Horman; +Cc: kexec
On 9 February 2015 at 13:58, Simon Horman <horms@verge.net.au> wrote:
> These changes do not seem to be related to each other.
> Please split this into 4 separate patches each with
> a changelog that briefly describes what the problem is.
>
Will split them each into a separate patch.
> On Sun, Feb 01, 2015 at 12:10:08AM +0800, Yousong Zhou wrote:
>>
>> Signed-off-by: Yousong Zhou <yszhou4tech@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;
>
> I wonder if we can resolve this without resorting to a cast.
It's a "pointer to integer without cast" warning. I think keeping
(unsigned long) for a pointer is fine, isnt it?
>
>> 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;
>>
This one has already been fixed by explicitly initialising the local
variable. So I will drop it in the next version.
Thank you for your time on this.
yousong
>> 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
>>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] Fix a few compilation warnings.
2015-02-09 12:56 ` Yousong Zhou
@ 2015-02-10 0:14 ` Simon Horman
0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2015-02-10 0:14 UTC (permalink / raw)
To: Yousong Zhou; +Cc: kexec
On Mon, Feb 09, 2015 at 08:56:25PM +0800, Yousong Zhou wrote:
> On 9 February 2015 at 13:58, Simon Horman <horms@verge.net.au> wrote:
> > These changes do not seem to be related to each other.
> > Please split this into 4 separate patches each with
> > a changelog that briefly describes what the problem is.
> >
>
> Will split them each into a separate patch.
>
> > On Sun, Feb 01, 2015 at 12:10:08AM +0800, Yousong Zhou wrote:
> >>
> >> Signed-off-by: Yousong Zhou <yszhou4tech@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;
> >
> > I wonder if we can resolve this without resorting to a cast.
>
> It's a "pointer to integer without cast" warning. I think keeping
> (unsigned long) for a pointer is fine, isnt it?
Yes, I guess it is the least-bad solution.
>
> >
> >> 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;
> >>
>
> This one has already been fixed by explicitly initialising the local
> variable. So I will drop it in the next version.
>
> Thank you for your time on this.
Likewise, thanks for spending time on this.
> yousong
>
> >> 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
> >>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-02-10 0:15 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-31 16:10 [PATCH 1/3] configure.ac: quote result of AC_CHECK_LIB() Yousong Zhou
2015-01-31 16:10 ` [PATCH 2/3] Fix zlib/lzma decompression Yousong Zhou
2015-02-09 6:00 ` Simon Horman
2015-01-31 16:10 ` [PATCH 3/3] Fix a few compilation warnings Yousong Zhou
2015-02-09 5:58 ` Simon Horman
2015-02-09 12:56 ` Yousong Zhou
2015-02-10 0:14 ` Simon Horman
2015-02-09 5:56 ` [PATCH 1/3] configure.ac: quote result of AC_CHECK_LIB() Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox