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: <CAKwvOdnT8Xnq0a495h7-18qAB+5eb9Lw+oKfGef7BErGfXFYUg@mail.gmail.com>
Date:   Thu, 7 Mar 2019 16:13:33 -0800
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Nathan Chancellor <natechancellor@...il.com>
Cc:     "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        LKML <linux-kernel@...r.kernel.org>,
        clang-built-linux@...glegroups.com
Subject: Re: [PATCH] net: ethernet: sun: Zero initialize class in default case
 in niu_add_ethtool_tcam_entry

On Thu, Mar 7, 2019 at 3:29 PM Nathan Chancellor
<natechancellor@...il.com> wrote:
>
> When building with -Wsometimes-uninitialized, Clang warns:
>
> drivers/net/ethernet/sun/niu.c:7466:5: warning: variable 'class' is used
> uninitialized whenever switch default is taken
> [-Wsometimes-uninitialized]
>
> The default case can never happen because i can only be 0 to 3
> (NIU_L3_PROG_CLS is defined as 4). To make this clear to Clang,
> just zero initialize class in the default case (use the macro
> CLASS_CODE_UNRECOG to make it clear this shouldn't happen).

Good choice. Thanks for the patch.
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>

>
> Link: https://github.com/ClangBuiltLinux/linux/issues/403
> Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
> ---
>  drivers/net/ethernet/sun/niu.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
> index d84501441edd..6f99437a6962 100644
> --- a/drivers/net/ethernet/sun/niu.c
> +++ b/drivers/net/ethernet/sun/niu.c
> @@ -7464,6 +7464,7 @@ static int niu_add_ethtool_tcam_entry(struct niu *np,
>                                         class = CLASS_CODE_USER_PROG4;
>                                         break;
>                                 default:
> +                                       class = CLASS_CODE_UNRECOG;
>                                         break;
>                                 }
>                                 ret = tcam_user_ip_class_set(np, class, 0,
> --
> 2.21.0
>


-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ