diff mbox series

[next] scsi: ufs: Fix unsigned int compared with less than zero

Message ID 20210806144301.19864-1-colin.king@canonical.com (mailing list archive)
State Accepted
Headers show
Series [next] scsi: ufs: Fix unsigned int compared with less than zero | expand

Commit Message

Colin King Aug. 6, 2021, 2:43 p.m. UTC
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(-)

Comments

Bart Van Assche Aug. 6, 2021, 10:12 p.m. UTC | #1
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.
Martin K. Petersen Aug. 10, 2021, 3:15 a.m. UTC | #2
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 Aug. 17, 2021, 3:17 a.m. UTC | #3
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
diff mbox series

Patch

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;