Skip to contentSkip to conversation

linux-next: build warning after merge of the akpm-current tree

DISCUSSION Stephen Rothwell 2 participants 3 messages May 15, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Andrew,

After merging the akpm-current tree, today's linux-next build (arm multi_v7_defconfig) produced this warning:

In file included from include/asm-generic/bug.h:15:0,

                 from arch/arm/include/asm/bug.h:59,
                 from include/linux/bug.h:4,
                 from include/linux/elfcore.h:5,
                 from include/linux/crash_core.h:5,
                 from kernel/crash_core.c:9:
kernel/crash_core.c: In function 'vmcoreinfo_append_str':
include/linux/kernel.h:757:16: warning: comparison of distinct pointer types lacks a cast
  (void) (&min1 == &min2);   \
                ^

include/linux/kernel.h:760:2: note: in expansion of macro '__min'
__min(typeof(x), typeof(y), \
^
kernel/crash_core.c:360:6: note: in expansion of macro 'min'

  r = min(r, VMCOREINFO_BYTES - vmcoreinfo_size);
      ^

Introduced by commit

fc7d2b44367f ("powerpc/fadump: use the correct VMCOREINFO_NOTE_SIZE for phdr")

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 19 lines · Stephen Rothwell

Hi Andrew,

After merging the akpm-current tree, today's linux-next build (arm multi_v7_defconfig) produced this warning:

In file included from include/asm-generic/bug.h:15:0,

                 from arch/arm/include/asm/bug.h:59,
                 from include/linux/bug.h:4,
                 from include/linux/elfcore.h:5,
                 from include/linux/crash_core.h:5,
                 from kernel/crash_core.c:9:
kernel/crash_core.c: In function 'vmcoreinfo_append_str':
include/linux/kernel.h:757:16: warning: comparison of distinct pointer types lacks a cast
  (void) (&min1 == &min2);   \
                ^

include/linux/kernel.h:760:2: note: in expansion of macro '__min'
__min(typeof(x), typeof(y), \
^
kernel/crash_core.c:360:6: note: in expansion of macro 'min'

Quoted 7 lines
  r = min(r, VMCOREINFO_BYTES - vmcoreinfo_size);
      ^

Introduced by commit

fc7d2b44367f ("powerpc/fadump: use the correct VMCOREINFO_NOTE_SIZE for phdr")

Hi Stephen/Andrew,

Sorry for the trouble.

The following patch will fix it, do you want to me to send it out separately? or help merge it into fc7d2b44367f ("powerpc/fadump: use the correct VMCOREINFO_NOTE_SIZE for phdr") directly?

Thanks,
Xunlei

===========================================

From: Xunlei Pang <[email protected]>
Subject: [PATCH] crash: Fix build warning

linux-next build (arm multi_v7_defconfig) produced this warning:

In file included from include/asm-generic/bug.h:15:0,

                 from arch/arm/include/asm/bug.h:59,
                 from include/linux/bug.h:4,
                 from include/linux/elfcore.h:5,
                 from include/linux/crash_core.h:5,
                 from kernel/crash_core.c:9:
kernel/crash_core.c: In function 'vmcoreinfo_append_str':
include/linux/kernel.h:757:16: warning: comparison of distinct pointer
types lacks a cast
  (void) (&min1 == &min2);   \
                ^

include/linux/kernel.h:760:2: note: in expansion of macro '__min'
__min(typeof(x), typeof(y), \
^
kernel/crash_core.c:360:6: note: in expansion of macro 'min'

  r = min(r, VMCOREINFO_BYTES - vmcoreinfo_size);
      ^

This patch fixes it.

---
 kernel/crash_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/crash_core.c +1 -1
index 4a4a4ba..6db80fc 100644
@@ -357,7 +357,7 @@ void vmcoreinfo_append_str(const char *fmt, ...)
     r = vscnprintf(buf, sizeof(buf), fmt, args);
     va_end(args);
 
-    r = min(r, VMCOREINFO_BYTES - vmcoreinfo_size);
+    r = min(r, (size_t)VMCOREINFO_BYTES - vmcoreinfo_size);
 
     memcpy(&vmcoreinfo_data[vmcoreinfo_size], buf, r);
 
Signature · 1 line
1.8.3.1
#2 lore raw

Hi Xunlei,

Quoted 3 lines · On Mon, 15 May 2017 12:02:18 +0800 Xunlei Pang <[email protected]> wrote:

The following patch will fix it, do you want to me to send it out separately? or help merge it into fc7d2b44367f ("powerpc/fadump: use the correct VMCOREINFO_NOTE_SIZE for phdr") directly?

Andrew normally takes these as separate patches and then merges them before sending them on.

Signature · 2 lines
Cheers,
Stephen Rothwell