diff mbox series

[next] scsi: elx: libefc: Fix less than zero comparison of a unsigned int

Message ID 20210616170401.15831-1-colin.king@canonical.com
State New
Headers show
Series [next] scsi: elx: libefc: Fix less than zero comparison of a unsigned int | expand

Commit Message

Colin King June 16, 2021, 5:04 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The comparison of the u32 variable rc to less than zero always
false because it is unsigned. Fix this by making it an int.

Addresses-Coverity: ("Unsigned compared against 0")
Fixes: 202bfdffae27 ("scsi: elx: libefc: FC node ELS and state handling")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/elx/libefc/efc_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin K. Petersen June 19, 2021, 2:28 a.m. UTC | #1
Colin,

> The comparison of the u32 variable rc to less than zero always false

> because it is unsigned. Fix this by making it an int.


Applied to 5.14/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering
James Smart June 19, 2021, 3:46 p.m. UTC | #2
On 6/16/2021 10:04 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>

> 

> The comparison of the u32 variable rc to less than zero always

> false because it is unsigned. Fix this by making it an int.

> 

> Addresses-Coverity: ("Unsigned compared against 0")

> Fixes: 202bfdffae27 ("scsi: elx: libefc: FC node ELS and state handling")

> Signed-off-by: Colin Ian King <colin.king@canonical.com>

> ---

>   drivers/scsi/elx/libefc/efc_device.c | 2 +-

>   1 file changed, 1 insertion(+), 1 deletion(-)


Thanks!

Reviewed-by: James Smart <jsmart2021@gmail.com>


-- james
diff mbox series

Patch

diff --git a/drivers/scsi/elx/libefc/efc_device.c b/drivers/scsi/elx/libefc/efc_device.c
index 31a688bce6e9..725ca2a23fb2 100644
--- a/drivers/scsi/elx/libefc/efc_device.c
+++ b/drivers/scsi/elx/libefc/efc_device.c
@@ -15,7 +15,7 @@ 
 void
 efc_d_send_prli_rsp(struct efc_node *node, u16 ox_id)
 {
-	u32 rc = EFC_SCSI_CALL_COMPLETE;
+	int rc = EFC_SCSI_CALL_COMPLETE;
 	struct efc *efc = node->efc;
 
 	node->ls_acc_oxid = ox_id;