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] [day] [month] [year] [list]
Message-ID: <20180514141523.tmc3yfad5wj2vkop@mwanda>
Date:   Mon, 14 May 2018 17:15:23 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Nathan Chancellor <natechancellor@...il.com>
Cc:     devel@...verdev.osuosl.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/7] staging: ks7010: Remove unnecessary limit checks

On Mon, May 14, 2018 at 07:06:22AM -0700, Nathan Chancellor wrote:
> On Mon, May 14, 2018 at 04:17:36PM +0300, Dan Carpenter wrote:
> > On Sun, May 06, 2018 at 03:03:00PM -0700, Nathan Chancellor wrote:
> > > uwrq is an unsigned 32-bit integer, it cannot be less than zero.
> > > 
> > > Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
> > > ---
> > >  drivers/staging/ks7010/ks_wlan_net.c | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
> > > index e96477937f65..0c83d6fe270f 100644
> > > --- a/drivers/staging/ks7010/ks_wlan_net.c
> > > +++ b/drivers/staging/ks7010/ks_wlan_net.c
> > > @@ -1928,7 +1928,7 @@ static int ks_wlan_set_beacon_lost(struct net_device *dev,
> > >  	if (priv->sleep_mode == SLP_SLEEP)
> > >  		return -EPERM;
> > >  	/* for SLEEP MODE */
> > > -	if (*uwrq < BEACON_LOST_COUNT_MIN || *uwrq > BEACON_LOST_COUNT_MAX)
> > > +	if (*uwrq > BEACON_LOST_COUNT_MAX)
> > 
> > I believe Smatch is supposed to ignore this sort of code because
> > comparing "if (foo < 0 || foo > max) " is pretty readable and idiomatic.
> > 
> > Presumably this was so we could redefine BEACON_LOST_COUNT_MIN, but it's
> > fine to unused code.  The define isn't needed at all, so you can
> > delete that as well.
> > 
> > regards,
> > dan carpenter
> > 
> 
> Hi Dan,
> 
> Thanks for the suggestion, I just sent a patch.
> 
> This warning came from GCC as a -Wtype-limit warning. I should have put
> that in the commit message to be more clear. I will keep this in mind
> for the future if I come across any more checks like this with defines.
> 

Anyway, please delete BEACON_LOST_COUNT_MIN entirely.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ