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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025041520-culinary-obsessive-1dc3@gregkh>
Date: Tue, 15 Apr 2025 16:52:06 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Purva Yeshi <purvayeshi550@...il.com>
Cc: arnd@...db.de, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] char: mwave: smapi: Make usSmapiOK signed to fix warning

On Thu, Apr 10, 2025 at 02:49:29AM +0530, Purva Yeshi wrote:
> Fix Smatch-detected warning:
> drivers/char/mwave/smapi.c:69 smapi_request() warn:
> assigning (-5) to unsigned variable 'usSmapiOK'
> 
> Assigning a negative value (-EIO, which is -5) to an unsigned short
> (usSmapiOK) causes a Smatch warning because negative values cannot
> be correctly represented in an unsigned type, leading to unexpected
> behavior.
> 
> Change the type of usSmapiOK from unsigned short to short to allow
> storing negative values like -EIO without causing a type mismatch or
> logic error.
> 
> Signed-off-by: Purva Yeshi <purvayeshi550@...il.com>
> ---
>  drivers/char/mwave/smapi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/mwave/smapi.c b/drivers/char/mwave/smapi.c
> index f8d79d393b69..37da1339357e 100644
> --- a/drivers/char/mwave/smapi.c
> +++ b/drivers/char/mwave/smapi.c
> @@ -66,7 +66,7 @@ static int smapi_request(unsigned short inBX, unsigned short inCX,
>  	unsigned short myoutDX = 5, *pmyoutDX = &myoutDX;
>  	unsigned short myoutDI = 6, *pmyoutDI = &myoutDI;
>  	unsigned short myoutSI = 7, *pmyoutSI = &myoutSI;
> -	unsigned short usSmapiOK = -EIO, *pusSmapiOK = &usSmapiOK;
> +	short usSmapiOK = -EIO, *pusSmapiOK = &usSmapiOK;

This no longer a "us" variable type :(

The joy of using this type of notation, ick.  Please fix this up to use
an explicit type (like s16), and fix the variable name at the same time.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ