lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzYeP784xwgnSsoCn=vy37-bLa4=jZUDW35t3MNMUGVdmA@mail.gmail.com>
Date:   Tue, 23 Jun 2020 11:27:41 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Quentin Monnet <quentin@...valent.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
        Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next] tools: bpftool: do not pass json_wtr to emit_obj_refs_json()

On Tue, Jun 23, 2020 at 8:54 AM Quentin Monnet <quentin@...valent.com> wrote:
>
> Building bpftool yields the following complaint:
>
>     pids.c: In function ‘emit_obj_refs_json’:
>     pids.c:175:80: warning: declaration of ‘json_wtr’ shadows a global declaration [-Wshadow]
>       175 | void emit_obj_refs_json(struct obj_refs_table *table, __u32 id, json_writer_t *json_wtr)
>           |                                                                 ~~~~~~~~~~~~~~~^~~~~~~~
>     In file included from pids.c:11:
>     main.h:141:23: note: shadowed declaration is here
>       141 | extern json_writer_t *json_wtr;
>           |                       ^~~~~~~~
>
> json_wtr being exposed in main.h (included in pids.c) as an extern, it
> is directly available and there is no need to pass it through the
> function. Let's simply use the global variable.

I don't think it's a good approach to assume that emit_obj_refs_json
is always going to be using a global json writer. I think this shadow
warning is bogus in this case, honestly. But if it bothers you, let's
just rename json_wtr into whatever other name of argument you prefer.

>
> Signed-off-by: Quentin Monnet <quentin@...valent.com>
> ---
>  tools/bpf/bpftool/btf.c  | 2 +-
>  tools/bpf/bpftool/link.c | 2 +-
>  tools/bpf/bpftool/main.h | 3 +--
>  tools/bpf/bpftool/map.c  | 2 +-
>  tools/bpf/bpftool/pids.c | 2 +-
>  tools/bpf/bpftool/prog.c | 2 +-
>  6 files changed, 6 insertions(+), 7 deletions(-)
>

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ