Re: [PATCH -next v2] scsi: sd: Fix unsigned expression compared with zero in sd_spinup_disk()

From: Bart Van Assche
Date: Thu Jul 04 2024 - 13:44:01 EST


On 7/3/24 8:14 PM, Jiapeng Chong wrote:
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.

./drivers/scsi/sd.c:2333:6-16: WARNING: Unsigned expression compared with zero: the_result > 0.

Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9463
Signed-off-by: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>

The following is missing from this patch:
- An explanation of why this patch fixes a read of uninitialized data.
- Fixed: and Cc: stable tags.

Thanks,

Bart.