From: John Garry <john.g.garry@oracle.com>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>,
James.Bottomley@HansenPartnership.com
Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org,
Abaci Robot <abaci@linux.alibaba.com>,
michael.christie@oracle.com
Subject: Re: [PATCH] scsi: sd: Fix unsigned expression compared with zero
Date: Tue, 2 Jul 2024 10:44:11 +0100 [thread overview]
Message-ID: <486b02ed-48e1-4245-8cb5-b66045cc9c8c@oracle.com> (raw)
In-Reply-To: <20240701090603.127783-1-jiapeng.chong@linux.alibaba.com>
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@linux.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@linux.alibaba.com>
Looks ok, but Mike can hopefully double-check:
Reviewed-by: John Garry <john.g.garry@oracle.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 */
prev parent reply other threads:[~2024-07-02 9:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 9:06 [PATCH] scsi: sd: Fix unsigned expression compared with zero Jiapeng Chong
2024-07-01 16:50 ` Bart Van Assche
2024-07-01 17:08 ` Bart Van Assche
2024-07-02 9:44 ` John Garry [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=486b02ed-48e1-4245-8cb5-b66045cc9c8c@oracle.com \
--to=john.g.garry@oracle.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=abaci@linux.alibaba.com \
--cc=jiapeng.chong@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=michael.christie@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox