Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1452982 > unrolled thread

[PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1

Started byValdis Kletnieks <Valdis.Kletnieks@vt.edu>
First post2016-08-01 06:40 +0200
Last post2016-08-01 17:30 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1 Valdis Kletnieks <Valdis.Kletnieks@vt.edu> - 2016-08-01 06:40 +0200
    Re: [PATCH v2] bpf: silence warnings when building kernel/bpf/core.c  with W=1 Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-08-01 06:50 +0200
      Re: [PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1 Valdis.Kletnieks@vt.edu - 2016-08-01 07:30 +0200
        Re: [PATCH v2] bpf: silence warnings when building kernel/bpf/core.c  with W=1 Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-08-01 17:30 +0200

#1452982 — [PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1

FromValdis Kletnieks <Valdis.Kletnieks@vt.edu>
Date2016-08-01 06:40 +0200
Subject[PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1
Message-ID<s1dbb-1vs-11@gated-at.bofh.it>
Building with W=1 generates some 350 lines of warnings of the form:

kernel/bpf/core.c: In function '__bpf_prog_run':
kernel/bpf/core.c:476:33: warning: initialized field overwritten [-Woverride-init]
   [BPF_ALU | BPF_ADD | BPF_X] = &&ALU_ADD_X,
                                 ^~
kernel/bpf/core.c:476:33: note: (near initialization for 'jumptable[12]')

Since they come from the way we intentionally build the table, silence
that one specific warning.

Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>

Version 2: Add bpf: subsystem tag to subject line

diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
index eed911d091da..bb915f9d9f92 100644
--- a/kernel/bpf/Makefile
+++ b/kernel/bpf/Makefile
@@ -1,3 +1,4 @@
+CFLAGS_core.o += -Wno-override-init
 obj-y := core.o
 
 obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o

[toc] | [next] | [standalone]


#1452986 — Re: [PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1

FromAlexei Starovoitov <alexei.starovoitov@gmail.com>
Date2016-08-01 06:50 +0200
SubjectRe: [PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1
Message-ID<s1dkR-1zw-5@gated-at.bofh.it>
In reply to#1452982
On Mon, Aug 01, 2016 at 12:33:30AM -0400, Valdis Kletnieks wrote:
> Building with W=1 generates some 350 lines of warnings of the form:
> 
> kernel/bpf/core.c: In function '__bpf_prog_run':
> kernel/bpf/core.c:476:33: warning: initialized field overwritten [-Woverride-init]
>    [BPF_ALU | BPF_ADD | BPF_X] = &&ALU_ADD_X,
>                                  ^~
> kernel/bpf/core.c:476:33: note: (near initialization for 'jumptable[12]')
> 
> Since they come from the way we intentionally build the table, silence
> that one specific warning.
> 
> Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
> 
> Version 2: Add bpf: subsystem tag to subject line
> 
> diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
> index eed911d091da..bb915f9d9f92 100644
> --- a/kernel/bpf/Makefile
> +++ b/kernel/bpf/Makefile
> @@ -1,3 +1,4 @@
> +CFLAGS_core.o += -Wno-override-init

and at least 2 other such patches for other files...
Is there a single warning where -Woverride-init was useful?
May be worth disabling this warning for the whole build?

[toc] | [prev] | [next] | [standalone]


#1452990

FromValdis.Kletnieks@vt.edu
Date2016-08-01 07:30 +0200
Message-ID<s1dXz-24Q-3@gated-at.bofh.it>
In reply to#1452986

[Multipart message — attachments visible in raw view] — view raw

On Sun, 31 Jul 2016 21:42:22 -0700, Alexei Starovoitov said:

> and at least 2 other such patches for other files...
> Is there a single warning where -Woverride-init was useful?
> May be worth disabling this warning for the whole build?

There's a few other cases that *aren't* the "define the array to zero
and then build the entries from a list" form.

In particular, there's still 3 odd complaints:

drivers/ata/ahci.c:
drivers/ata/ahci.h:393:16: warning: initialized field overwritten [-Woverride-in
it]
  .can_queue  = AHCI_MAX_CMDS - 1,

drivers/block/drbd/drbd_main.c:
drivers/block/drbd/drbd_main.c:3767:22: warning: initialized field overwritten [
-Woverride-init]
   [P_RETRY_WRITE]  = "retry_write",

arch/x86/kernel/cpu/common.c:
./arch/x86/include/asm/page_64_types.h:22:21: warning: initialized field overwri
tten [-Woverride-init]
 #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)

The point of these patches is to make -Woverride-init *useful* - you'll never
spot 3 warnings in a flood of over 9,000 understood-and-ignored warnings.

Get rid of the 9,000 understood-and-ignored warnings, and then things that
probably *should* be looked at can be noticed.

[toc] | [prev] | [next] | [standalone]


#1453280 — Re: [PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1

FromAlexei Starovoitov <alexei.starovoitov@gmail.com>
Date2016-08-01 17:30 +0200
SubjectRe: [PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1
Message-ID<s1nke-834-29@gated-at.bofh.it>
In reply to#1452990
On Mon, Aug 01, 2016 at 01:18:43AM -0400, Valdis.Kletnieks@vt.edu wrote:
> On Sun, 31 Jul 2016 21:42:22 -0700, Alexei Starovoitov said:
> 
> > and at least 2 other such patches for other files...
> > Is there a single warning where -Woverride-init was useful?
> > May be worth disabling this warning for the whole build?
> 
> There's a few other cases that *aren't* the "define the array to zero
> and then build the entries from a list" form.
> 
> In particular, there's still 3 odd complaints:
> 
> drivers/ata/ahci.c:
> drivers/ata/ahci.h:393:16: warning: initialized field overwritten [-Woverride-in
> it]
>   .can_queue  = AHCI_MAX_CMDS - 1,
> 
> drivers/block/drbd/drbd_main.c:
> drivers/block/drbd/drbd_main.c:3767:22: warning: initialized field overwritten [
> -Woverride-init]
>    [P_RETRY_WRITE]  = "retry_write",
> 
> arch/x86/kernel/cpu/common.c:
> ./arch/x86/include/asm/page_64_types.h:22:21: warning: initialized field overwri
> tten [-Woverride-init]
>  #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
> 
> The point of these patches is to make -Woverride-init *useful* - you'll never
> spot 3 warnings in a flood of over 9,000 understood-and-ignored warnings.
> 
> Get rid of the 9,000 understood-and-ignored warnings, and then things that
> probably *should* be looked at can be noticed.

I don't think it makes sense to play kernel whack-a-warning in a hope that
particular warning will find something useful.
Please show few cases where it actually found a real issue, otherwise
just disable it for all.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web