New linux-next KCFLAGS

Stephen Rothwell sfr at canb.auug.org.au
Mon Nov 26 08:48:41 AEDT 2018


Hi Kees,

On Fri, 26 Oct 2018 01:34:33 +0100 Kees Cook <keescook at google.com> wrote:
>
> So, if you it's possible to "seed" some new flags for linux-next, I'd
> be interested in making sure no new instances of warnings from
> -Wimplicit-fallthrough (gcc 7.1 and later) appear. VLAs will be gone
> in a couple days, so I'm currently only interested in killing implicit
> fallthroughs[1] now. There are hundreds of cases remaining, so ignore
> those on the first build, but anything NEW is what I'd like to get
> maintainer nags sent for (CCing myself and Gustavo Silva would be
> especially nice, too).

I don't know Gustavo's email address ...

> Thanks!
> 
> [1] Gustavo has fixed lots of actual bugs as part of this work:
>      https://lkml.kernel.org/r/1f64449a-ef19-20c8-f8cb-7e629f8fe71b@embeddedor.com

I finally got around to this.  I have added the following patch to my
fixes tree (which is merged immediately after Linus' tree).

commit 4d8360ade996cf1823e570544791c9d7bd660ffb
Author: Stephen Rothwell <sfr at canb.auug.org.au>
Date:   Mon Nov 26 07:58:34 2018 +1100

    Check for new cases of implict fallthrough
    
    for Kees
    
    Signed-off-by: Stephen Rothwell <sfr at canb.auug.org.au>

diff --git a/Makefile b/Makefile
index ddbf627cad8f..380164f590bc 100644
--- a/Makefile
+++ b/Makefile
@@ -804,6 +804,9 @@ KBUILD_CFLAGS += -Wdeclaration-after-statement
 # Variable Length Arrays (VLAs) should not be used anywhere in the kernel
 KBUILD_CFLAGS += $(call cc-option,-Wvla)
 
+# Check for implict fallthroughs
+KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough)
+
 # disable pointer signed / unsigned warnings in gcc 4.0
 KBUILD_CFLAGS += -Wno-pointer-sign
 

Unfortunately, some of the kernel is built with -Werror, so I have had
to add the following patch as well just to build Linus' tree:

(I just marked them as "fall through", I am not sure if that is the
correct resolution.)

From: Stephen Rothwell <sfr at canb.auug.org.au>
Date: Mon, 26 Nov 2018 08:32:39 +1100
Subject: [PATCH] powerpc: tag implicit fall throughs

Signed-off-by: Stephen Rothwell <sfr at canb.auug.org.au>
---
 arch/powerpc/kernel/nvram_64.c            | 1 +
 arch/powerpc/platforms/powermac/feature.c | 1 +
 arch/powerpc/xmon/xmon.c                  | 1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index 22e9d281324d..06e2eda2430e 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -809,6 +809,7 @@ static long dev_nvram_ioctl(struct file *file, unsigned int cmd,
 #ifdef CONFIG_PPC_PMAC
 	case OBSOLETE_PMAC_NVRAM_GET_OFFSET:
 		printk(KERN_WARNING "nvram: Using obsolete PMAC_NVRAM_GET_OFFSET ioctl\n");
+		/* fall through */
 	case IOC_NVRAM_GET_OFFSET: {
 		int part, offset;
 
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index ed2f54b3f173..a7ec06876b53 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -1471,6 +1471,7 @@ static long g5_i2s_enable(struct device_node *node, long param, long value)
 	case 2:
 		if (macio->type == macio_shasta)
 			break;
+		/* fall through */
 	default:
 		return -ENODEV;
 	}
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 36b8dc47a3c3..308326f8b7ed 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -4033,6 +4033,7 @@ static int do_spu_cmd(void)
 		subcmd = inchar();
 		if (isxdigit(subcmd) || subcmd == '\n')
 			termch = subcmd;
+		/* fall through */
 	case 'f':
 		scanhex(&num);
 		if (num >= XMON_NUM_SPUS || !spu_info[num].spu) {
-- 
2.19.1

-- 
Cheers,
Stephen Rothwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20181126/fcc0b266/attachment-0001.sig>


More information about the Linuxppc-dev mailing list