All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] scsi: Fix return code handling in sd_spinup_disk
@ 2026-05-11 17:53 Mike Christie
  2026-05-12 19:58 ` Bart Van Assche
  2026-05-15  2:03 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Christie @ 2026-05-11 17:53 UTC (permalink / raw)
  To: martin.petersen, linux-scsi, james.bottomley, error27; +Cc: Mike Christie

As found by smatch-ci scsi_execute_cmd can return negative or positve
values so we should use a int instead of unsigned int.

Fixes: b4d0c33a32c3 ("scsi: sd: Fix sshdr use in sd_spinup_disk")
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/linux-scsi/agFbI7E6JQwd3wGW@stanley.mountain/T/#u
Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/scsi/sd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index adc3fa55ca2c..599e75f33334 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2476,8 +2476,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, spintime, sense_valid = 0;
 	struct scsi_sense_hdr sshdr;
 	struct scsi_failure failure_defs[] = {
 		/* Do not retry Medium Not Present */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] scsi: Fix return code handling in sd_spinup_disk
  2026-05-11 17:53 [PATCH 1/1] scsi: Fix return code handling in sd_spinup_disk Mike Christie
@ 2026-05-12 19:58 ` Bart Van Assche
  2026-05-15  2:03 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2026-05-12 19:58 UTC (permalink / raw)
  To: Mike Christie, martin.petersen, linux-scsi, james.bottomley,
	error27

On 5/11/26 10:53 AM, Mike Christie wrote:
> As found by smatch-ci scsi_execute_cmd can return negative or positve
> values so we should use a int instead of unsigned int.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] scsi: Fix return code handling in sd_spinup_disk
  2026-05-11 17:53 [PATCH 1/1] scsi: Fix return code handling in sd_spinup_disk Mike Christie
  2026-05-12 19:58 ` Bart Van Assche
@ 2026-05-15  2:03 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2026-05-15  2:03 UTC (permalink / raw)
  To: Mike Christie; +Cc: martin.petersen, linux-scsi, james.bottomley, error27


Mike,

> As found by smatch-ci scsi_execute_cmd can return negative or positve
> values so we should use a int instead of unsigned int.

Applied to 7.1/scsi-fixes, thanks!

-- 
Martin K. Petersen

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-15  2:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 17:53 [PATCH 1/1] scsi: Fix return code handling in sd_spinup_disk Mike Christie
2026-05-12 19:58 ` Bart Van Assche
2026-05-15  2:03 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.