linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] scsi: ufs: Fix unsigned int compared with less than zero
@ 2021-08-06 14:43 Colin King
  2021-08-06 22:12 ` Bart Van Assche
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Colin King @ 2021-08-06 14:43 UTC (permalink / raw)
  To: Alim Akhtar, Avri Altman, James E . J . Bottomley,
	Martin K . Petersen, Daejun Park, linux-scsi
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Variable tag is currently and unsigned int and is being compared to
less than zero, this check is always false. Fix this by making tag
an int.

Addresses-Coverity: ("Macro compares unsigned to 0")
Fixes: 4728ab4a8e64 ("scsi: ufs: Remove ufshcd_valid_tag()")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/ufs/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 47a5085f16a9..21378682cb4f 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6976,7 +6976,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
 {
 	struct Scsi_Host *host = cmd->device->host;
 	struct ufs_hba *hba = shost_priv(host);
-	unsigned int tag = cmd->request->tag;
+	int tag = cmd->request->tag;
 	struct ufshcd_lrb *lrbp = &hba->lrb[tag];
 	unsigned long flags;
 	int err = FAILED;
-- 
2.31.1


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

* Re: [PATCH][next] scsi: ufs: Fix unsigned int compared with less than zero
  2021-08-06 14:43 [PATCH][next] scsi: ufs: Fix unsigned int compared with less than zero Colin King
@ 2021-08-06 22:12 ` Bart Van Assche
  2021-08-10  3:15 ` Martin K. Petersen
  2021-08-17  3:17 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2021-08-06 22:12 UTC (permalink / raw)
  To: Colin King, Alim Akhtar, Avri Altman, James E . J . Bottomley,
	Martin K . Petersen, Daejun Park, linux-scsi
  Cc: kernel-janitors, linux-kernel

On 8/6/21 7:43 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Variable tag is currently and unsigned int and is being compared to
> less than zero, this check is always false. Fix this by making tag
> an int.
> 
> Addresses-Coverity: ("Macro compares unsigned to 0")
> Fixes: 4728ab4a8e64 ("scsi: ufs: Remove ufshcd_valid_tag()")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/scsi/ufs/ufshcd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 47a5085f16a9..21378682cb4f 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -6976,7 +6976,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
>   {
>   	struct Scsi_Host *host = cmd->device->host;
>   	struct ufs_hba *hba = shost_priv(host);
> -	unsigned int tag = cmd->request->tag;
> +	int tag = cmd->request->tag;
>   	struct ufshcd_lrb *lrbp = &hba->lrb[tag];
>   	unsigned long flags;
>   	int err = FAILED;

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

Thanks!

Bart.

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

* Re: [PATCH][next] scsi: ufs: Fix unsigned int compared with less than zero
  2021-08-06 14:43 [PATCH][next] scsi: ufs: Fix unsigned int compared with less than zero Colin King
  2021-08-06 22:12 ` Bart Van Assche
@ 2021-08-10  3:15 ` Martin K. Petersen
  2021-08-17  3:17 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2021-08-10  3:15 UTC (permalink / raw)
  To: Colin King
  Cc: Alim Akhtar, Avri Altman, James E . J . Bottomley,
	Martin K . Petersen, Daejun Park, linux-scsi, kernel-janitors,
	linux-kernel


Colin,

> Variable tag is currently and unsigned int and is being compared to
> less than zero, this check is always false. Fix this by making tag an
> int.

Applied to 5.15/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH][next] scsi: ufs: Fix unsigned int compared with less than zero
  2021-08-06 14:43 [PATCH][next] scsi: ufs: Fix unsigned int compared with less than zero Colin King
  2021-08-06 22:12 ` Bart Van Assche
  2021-08-10  3:15 ` Martin K. Petersen
@ 2021-08-17  3:17 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2021-08-17  3:17 UTC (permalink / raw)
  To: Avri Altman, Colin King, Daejun Park, James E . J . Bottomley,
	linux-scsi, Alim Akhtar
  Cc: Martin K . Petersen, kernel-janitors, linux-kernel

On Fri, 6 Aug 2021 15:43:01 +0100, Colin King wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Variable tag is currently and unsigned int and is being compared to
> less than zero, this check is always false. Fix this by making tag
> an int.
> 
> 
> [...]

Applied to 5.15/scsi-queue, thanks!

[1/1] scsi: ufs: Fix unsigned int compared with less than zero
      https://git.kernel.org/mkp/scsi/c/a5402cdcc2a9

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-08-17  3:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 14:43 [PATCH][next] scsi: ufs: Fix unsigned int compared with less than zero Colin King
2021-08-06 22:12 ` Bart Van Assche
2021-08-10  3:15 ` Martin K. Petersen
2021-08-17  3:17 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).