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]
Date: Tue, 2 Jul 2024 10:44:11 +0100
From: John Garry <john.g.garry@...cle.com>
To: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
        James.Bottomley@...senPartnership.com
Cc: martin.petersen@...cle.com, linux-scsi@...r.kernel.org,
        linux-kernel@...r.kernel.org, Abaci Robot <abaci@...ux.alibaba.com>,
        michael.christie@...cle.com
Subject: Re: [PATCH] scsi: sd: Fix unsigned expression compared with zero

This title should really be more precise, like "Fix unsigned expression 
compared with zero in sd_spinup_disk()"

On 01/07/2024 10:06, Jiapeng Chong wrote:

+ Mike

> The return value from the call to scsi_execute_cmd() is int. However, the
> return value is being assigned to an unsigned int variable 'the_result',
> so making 'the_result' an int.

an "so making 'the_result' effectively an unsigned int", right?

> 
> ./drivers/scsi/sd.c:2333:6-16: WARNING: Unsigned expression compared with zero: the_result > 0.
> 
> Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
> Closes: https://urldefense.com/v3/__https://bugzilla.openanolis.cn/show_bug.cgi?id=9463__;!!ACWV5N9M2RV99hQ!MVk0tuPkuuYZTeD-oVg7RYLVba7HwHVUjWCL2CLavSPrJmuO4MSCUNQ0vqjbCSIKBN8eonwTlU4FxKD3vmHQQhN2YUhbLcnJ$
> Signed-off-by: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>

Looks ok, but Mike can hopefully double-check:

Reviewed-by: John Garry <john.g.garry@...cle.com>

> ---
>   drivers/scsi/sd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 979795dad62b..ade8c6cca295 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2396,7 +2396,7 @@ sd_spinup_disk(struct scsi_disk *sdkp)
>   	static const u8 cmd[10] = { TEST_UNIT_READY };
>   	unsigned long spintime_expire = 0;
>   	int spintime, sense_valid = 0;
> -	unsigned int the_result;
> +	int the_result;
>   	struct scsi_sense_hdr sshdr;
>   	struct scsi_failure failure_defs[] = {
>   		/* Do not retry Medium Not Present */


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ