Re: New linux-next KCFLAGS

Subsystems: kernel build + files below scripts/ (unless maintained elsewhere), linux for power macintosh, linux for powerpc (32-bit and 64-bit), the rest

6 messages, 3 authors, 2018-11-26 · open the first message on its own page

Re: New linux-next KCFLAGS

From: Stephen Rothwell <hidden>
Date: 2018-11-25 21:59:43

Hi Kees,

On Fri, 26 Oct 2018 01:34:33 +0100 Kees Cook [off-list ref] 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 [off-list ref]
Date:   Mon Nov 26 07:58:34 2018 +1100

    Check for new cases of implict fallthrough
    
    for Kees
    
    Signed-off-by: Stephen Rothwell [off-list ref]
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 <redacted>
Date: Mon, 26 Nov 2018 08:32:39 +1100
Subject: [PATCH] powerpc: tag implicit fall throughs

Signed-off-by: Stephen Rothwell <redacted>
---
 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

Re: New linux-next KCFLAGS

From: Kees Cook <hidden>
Date: 2018-11-26 05:49:14

On Sun, Nov 25, 2018 at 1:48 PM Stephen Rothwell [off-list ref] wrote:
Hi Kees,

On Fri, 26 Oct 2018 01:34:33 +0100 Kees Cook [off-list ref] wrote:
quoted
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 ...
quoted
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).
Excellent! (Though, wait, does this mean everyone _else_ will see this
too? I'm worried that will be way too noisy...)
FYI, I am currently ignoring 659 such warnings in Linus' tree ...
That sound about right. Before Gustavo started there maybe 1000 more. (!) :)

Thanks!

-Kees
quoted hunk
commit 4d8360ade996cf1823e570544791c9d7bd660ffb
Author: Stephen Rothwell [off-list ref]
Date:   Mon Nov 26 07:58:34 2018 +1100

    Check for new cases of implict fallthrough

    for Kees

    Signed-off-by: Stephen Rothwell [off-list ref]
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 <redacted>
Date: Mon, 26 Nov 2018 08:32:39 +1100
Subject: [PATCH] powerpc: tag implicit fall throughs

Signed-off-by: Stephen Rothwell <redacted>
---
 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


-- 
Kees Cook

Re: New linux-next KCFLAGS

From: Stephen Rothwell <hidden>
Date: 2018-11-26 06:52:00

Hi Kees,

On Sun, 25 Nov 2018 21:46:20 -0800 Kees Cook [off-list ref] wrote:
Excellent! (Though, wait, does this mean everyone _else_ will see this
too? I'm worried that will be way too noisy...)
Ah, yes, you may be right.  everyone will see them :-(

I may have to figure out another way to do this for tomorrow.

-- 
Cheers,
Stephen Rothwell

Re: New linux-next KCFLAGS

From: Stephen Rothwell <hidden>
Date: 2018-11-26 07:00:03

Hi Kees,

On Mon, 26 Nov 2018 17:49:26 +1100 Stephen Rothwell [off-list ref] wrote:
On Sun, 25 Nov 2018 21:46:20 -0800 Kees Cook [off-list ref] wrote:
quoted
Excellent! (Though, wait, does this mean everyone _else_ will see this
too? I'm worried that will be way too noisy...)  
Ah, yes, you may be right.  everyone will see them :-(

I may have to figure out another way to do this for tomorrow.
For today, I will just revert the commit that adds the flag at the
end or my merging run.  People will only see the warnings if they are
bisecting.

-- 
Cheers,
Stephen Rothwell

Re: New linux-next KCFLAGS

From: Stephen Rothwell <hidden>
Date: 2018-11-26 14:03:21

Hi all,

On Mon, 26 Nov 2018 17:49:26 +1100 Stephen Rothwell [off-list ref] wrote:
On Sun, 25 Nov 2018 21:46:20 -0800 Kees Cook [off-list ref] wrote:
quoted
Excellent! (Though, wait, does this mean everyone _else_ will see this
too? I'm worried that will be way too noisy...)  
Ah, yes, you may be right.  everyone will see them :-(

I may have to figure out another way to do this for tomorrow.
OK, starting tomorrow (later today), I have just added
-Wimplicit-fallthrough to KCFLAGS in my build scripts.

-- 
Cheers,
Stephen Rothwell

Re: New linux-next KCFLAGS

From: Gustavo A. R. Silva <hidden>
Date: 2018-11-26 14:49:22


On 11/26/18 8:00 AM, Stephen Rothwell wrote:
Hi all,

On Mon, 26 Nov 2018 17:49:26 +1100 Stephen Rothwell [off-list ref] wrote:
quoted
On Sun, 25 Nov 2018 21:46:20 -0800 Kees Cook [off-list ref] wrote:
quoted
Excellent! (Though, wait, does this mean everyone _else_ will see this
too? I'm worried that will be way too noisy...)
Ah, yes, you may be right.  everyone will see them :-(

I may have to figure out another way to do this for tomorrow.
OK, starting tomorrow (later today), I have just added
-Wimplicit-fallthrough to KCFLAGS in my build scripts.
Awesome!

Thank you, Stephen. :)
--
Gustavo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help