scsi: ufs: Fix unsigned int compared with less than zero
Subsystems (2)
PATCH 1/1 scsi: ufs: Fix unsigned int compared with less than zero
From: Colin Ian King <[email protected]>
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")
--- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +1 -1
@@ -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 ;
Signature · 1 line
2.31.1
Quoted 18 lines · Colin King
From: Colin Ian King <[email protected]>
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 <[email protected]>--- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/ufs/ufshcd.c +0
-0
drivers/scsi/ufs/ufshcd.c static int ufshcd_abort(struct scsi_cmnd *cmd) · line 6982
Quoted 8 lines
drivers/scsi/ufs/ufshcd.c +1
-1@@ -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 ;
Thanks!
Bart.
Martin K. Petersen
AppliedColin,
Quoted 3 lines
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!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 8 lines · Colin King
From: Colin Ian King <[email protected]>
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
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering