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: <a0ee4c6252ba69ec1425421ed3f297b12dfdcc3f.camel@perches.com>
Date:   Wed, 02 Feb 2022 03:21:17 -0800
From:   Joe Perches <joe@...ches.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>,
        Kees Cook <keescook@...omium.org>
Cc:     Pkshih <pkshih@...ltek.com>, "kvalo@...nel.org" <kvalo@...nel.org>,
        "linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
        "colin.i.king@...il.com" <colin.i.king@...il.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] rtlwifi: remove redundant initialization of variable
 ul_encalgo

On Wed, 2022-02-02 at 14:05 +0300, Dan Carpenter wrote:
> On Wed, Feb 02, 2022 at 02:10:40AM -0800, Joe Perches wrote:
> > On Wed, 2022-02-02 at 08:02 +0300, Dan Carpenter wrote:
> > > On Mon, Jan 31, 2022 at 02:53:40AM +0000, Pkshih wrote:
> > > > On Sun, 2022-01-30 at 22:37 +0000, Colin Ian King wrote:
> > > > 
> > > > When I check this patch, I find there is no 'break' for default case.
> > > > Do we need one? like
> > > > 
> > > > @@ -226,6 +226,7 @@ void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index)
> > > >                 break;
> > > >         default:
> > > >                 ul_encalgo = rtlpriv->cfg->maps[SEC_CAM_AES];
> > > > +               break;
> > > 
> > > No, it's not necessary.  The choice of style is up to the original
> > > developer.
> > 
> > every case should have one.
> > 
> > Documentation/process/deprecated.rst:
> > 
> > All switch/case blocks must end in one of:
> > 
> > * break;
> > * fallthrough;
> > * continue;
> > * goto <label>;
> > * return [expression];
> > 
> 
> I doubt that's what Kees had in mind when he wrote that.

uhh, I wrote that.  I think Kees reformatted it for .rst

> The extra break statement doesn't improve readability.  It also doesn't
> hurt readability.
> 
> There is no reason to add a break statement after a default case.  No
> one is going to add another case after the default case.

Several hundred switch statements in the kernel use default:
as the first block.

> And if they
> do then a dozen static analysis tools will complain about the missing
> break.

true, doesn't mean that's a good thing.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ