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:   Fri, 14 Jun 2019 14:24:14 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Nathan Huckleberry <nhuck@...gle.com>
Cc:     John Stultz <john.stultz@...aro.org>,
        Thomas Gleixner <tglx@...utronix.de>, sboyd@...nel.org,
        LKML <linux-kernel@...r.kernel.org>,
        clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH] timer_list: Fix Wunused-const-variable

On Fri, Jun 14, 2019 at 11:16 AM 'Nathan Huckleberry' via Clang Built
Linux <clang-built-linux@...glegroups.com> wrote:
>
> Clang produced the following warning when using allnoconfig
>
> kernel/time/timer_list.c:361:36: warning: unused variable
> 'timer_list_sops' [-Wunused-const-variable]
>    static const struct seq_operations timer_list_sops = {
>
> Code reliant on CONFIG_PROC_FS is not in ifdef guard.
> Created ifdef guard around proc_fs specific code.

Specifically, it sounds like proc_create_seq_private expands to an
empty GNU C statement expression (not sure why not a `static inline`
function returning `NULL` but ok), so in that case, this object full
of function pointer, and its pointed to static functions (whose sole
references are this object) all become dead code.

>
> Cc: clang-built-linux@...glegroups.com
> Link: https://github.com/ClangBuiltLinux/linux/issues/534
> Signed-off-by: Nathan Huckleberry <nhuck@...gle.com>

Thanks for the patch, looks good!  Make sure to include reported by
tags when someone else has reported an issue that you fix, in this
case:

Reported-by: kbuild test robot <lkp@...el.com>
Link: https://groups.google.com/forum/#!topic/clang-built-linux/w27FQOTlb70
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>

> ---
>  kernel/time/timer_list.c | 36 +++++++++++++++++++-----------------
>  1 file changed, 19 insertions(+), 17 deletions(-)
>
> diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
> index 98ba50dcb1b2..acb326f5f50a 100644
> --- a/kernel/time/timer_list.c
> +++ b/kernel/time/timer_list.c
> @@ -282,23 +282,6 @@ static inline void timer_list_header(struct seq_file *m, u64 now)
>         SEQ_printf(m, "\n");
>  }
>
> -static int timer_list_show(struct seq_file *m, void *v)
> -{
> -       struct timer_list_iter *iter = v;
> -
> -       if (iter->cpu == -1 && !iter->second_pass)
> -               timer_list_header(m, iter->now);
> -       else if (!iter->second_pass)
> -               print_cpu(m, iter->cpu, iter->now);
> -#ifdef CONFIG_GENERIC_CLOCKEVENTS
> -       else if (iter->cpu == -1 && iter->second_pass)
> -               timer_list_show_tickdevices_header(m);
> -       else
> -               print_tickdevice(m, tick_get_device(iter->cpu), iter->cpu);
> -#endif
> -       return 0;
> -}
> -
>  void sysrq_timer_list_show(void)
>  {
>         u64 now = ktime_to_ns(ktime_get());
> @@ -317,6 +300,24 @@ void sysrq_timer_list_show(void)
>         return;
>  }
>
> +#ifdef CONFIG_PROC_FS
> +static int timer_list_show(struct seq_file *m, void *v)
> +{
> +       struct timer_list_iter *iter = v;
> +
> +       if (iter->cpu == -1 && !iter->second_pass)
> +               timer_list_header(m, iter->now);
> +       else if (!iter->second_pass)
> +               print_cpu(m, iter->cpu, iter->now);
> +#ifdef CONFIG_GENERIC_CLOCKEVENTS
> +       else if (iter->cpu == -1 && iter->second_pass)
> +               timer_list_show_tickdevices_header(m);
> +       else
> +               print_tickdevice(m, tick_get_device(iter->cpu), iter->cpu);
> +#endif
> +       return 0;
> +}
> +
>  static void *move_iter(struct timer_list_iter *iter, loff_t offset)
>  {
>         for (; offset; offset--) {
> @@ -376,3 +377,4 @@ static int __init init_timer_list_procfs(void)
>         return 0;
>  }
>  __initcall(init_timer_list_procfs);
> +#endif
> --
> 2.22.0.410.gd8fdbe21b5-goog
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@...glegroups.com.
> To post to this group, send email to clang-built-linux@...glegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20190614181604.112297-1-nhuck%40google.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ