Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: ufs: Fix unsigned int compared with less than zero

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

Link: https://lore.kernel.org/r/20210806144301.19864-1-colin.king@canonical.com
Fixes: 4728ab4a8e64 ("scsi: ufs: Remove ufshcd_valid_tag()")
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Addresses-Coverity: ("Macro compares unsigned to 0")

authored by

Colin Ian King and committed by
Martin K. Petersen
a5402cdc 4758fd91

+1 -1
+1 -1
drivers/scsi/ufs/ufshcd.c
··· 6974 6974 { 6975 6975 struct Scsi_Host *host = cmd->device->host; 6976 6976 struct ufs_hba *hba = shost_priv(host); 6977 - unsigned int tag = cmd->request->tag; 6977 + int tag = cmd->request->tag; 6978 6978 struct ufshcd_lrb *lrbp = &hba->lrb[tag]; 6979 6979 unsigned long flags; 6980 6980 int err = FAILED;