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]
Date:   Mon, 26 Oct 2020 15:21:46 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Arnd Bergmann <arnd@...nel.org>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Arnd Bergmann <arnd@...db.de>, Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] bpf: fix -Wshadow warnings

On Mon, Oct 26, 2020 at 12:37 PM Arnd Bergmann <arnd@...nel.org> wrote:
>
> From: Arnd Bergmann <arnd@...db.de>
>
> There are thousands of warnings about one macro in a W=2 build:
>
> include/linux/filter.h:561:6: warning: declaration of 'ret' shadows a previous local [-Wshadow]
>
> Prefix all the locals in that macro with __ to avoid most of
> these warnings.
>
> Fixes: 492ecee892c2 ("bpf: enable program stats")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---

Acked-by: Andrii Nakryiko <andrii@...nel.org>

>  include/linux/filter.h | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/include/linux/filter.h b/include/linux/filter.h
> index 954f279fde01..20ba04583eaa 100644
> --- a/include/linux/filter.h
> +++ b/include/linux/filter.h
> @@ -558,21 +558,21 @@ struct sk_filter {
>  DECLARE_STATIC_KEY_FALSE(bpf_stats_enabled_key);
>
>  #define __BPF_PROG_RUN(prog, ctx, dfunc)       ({                      \
> -       u32 ret;                                                        \
> +       u32 __ret;                                                      \
>         cant_migrate();                                                 \
>         if (static_branch_unlikely(&bpf_stats_enabled_key)) {           \
> -               struct bpf_prog_stats *stats;                           \
> -               u64 start = sched_clock();                              \
> -               ret = dfunc(ctx, (prog)->insnsi, (prog)->bpf_func);     \
> -               stats = this_cpu_ptr(prog->aux->stats);                 \
> -               u64_stats_update_begin(&stats->syncp);                  \
> -               stats->cnt++;                                           \
> -               stats->nsecs += sched_clock() - start;                  \
> -               u64_stats_update_end(&stats->syncp);                    \
> +               struct bpf_prog_stats *__stats;                         \
> +               u64 __start = sched_clock();                            \
> +               __ret = dfunc(ctx, (prog)->insnsi, (prog)->bpf_func);   \
> +               __stats = this_cpu_ptr(prog->aux->stats);               \
> +               u64_stats_update_begin(&__stats->syncp);                \
> +               __stats->cnt++;                                         \
> +               __stats->nsecs += sched_clock() - __start;              \
> +               u64_stats_update_end(&__stats->syncp);                  \
>         } else {                                                        \
> -               ret = dfunc(ctx, (prog)->insnsi, (prog)->bpf_func);     \
> +               __ret = dfunc(ctx, (prog)->insnsi, (prog)->bpf_func);   \
>         }                                                               \
> -       ret; })
> +       __ret; })
>
>  #define BPF_PROG_RUN(prog, ctx)                                                \
>         __BPF_PROG_RUN(prog, ctx, bpf_dispatcher_nop_func)
> --
> 2.27.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ