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: <aX53mt0cFlcz_2VB@william-fedora>
Date: Sat, 31 Jan 2026 16:43:54 -0500
From: William Hansen-Baird <william.hansen.baird@...il.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: David Laight <david.laight.linux@...il.com>, gregkh@...uxfoundation.org,
	straube.linux@...il.com, linux-staging@...ts.linux.dev,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] staging: rtl8723bs: replace ternary comparison with
 min_t()

On Sat, Jan 31, 2026 at 08:35:55PM +0300, Dan Carpenter wrote:
> On Sat, Jan 31, 2026 at 03:55:25PM +0000, David Laight wrote:
> > > > @@ -1024,7 +1025,7 @@ static unsigned short rtw_parse_assoc_security_ies(struct adapter *padapter,
> > > >  			pstat->flags |= WLAN_STA_WPS;
> > > >  			copy_len = 0;
> > > >  		} else {
> > > > -			copy_len = ((wpa_ie_len+2) > sizeof(pstat->wpa_ie)) ? (sizeof(pstat->wpa_ie)):(wpa_ie_len+2);
> > > > +			copy_len = min_t(int, sizeof(pstat->wpa_ie), wpa_ie_len + 2);  
> > > 
> > > Use umin().  "int" is wrong because we don't want negative values
> > > stored in copy_len.
> > 
> > And the correct way to fix min() bleating is to change the type of the variables.
> > Using min_t() ought to be frowned up and only used as a last resort.
> > 
> > In this case I think all the variables declared with wpa_ie_len can/should be
> > unsigned int.
> > 
> 
> That also works.
> 
Hi Dan and David,

Thanks for your help. After reviewing the code, I do see a few checks 
ensuring wpa_ie_len is never negative.
Therefore umin() is safe in this case, and for v3 I'll update the patch accordingly.

Would you prefer I leave it at that, or is a broader change to 
make wpa_ie_len unsigned worth doing in a separate patch?

Thanks,
William

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ