Skip to contentSkip to conversation

cxgb4: Signedness bug in init_one()

PATCH Applied Dan Carpenter 2 participants 2 messages Sep 25, 2019 – Sep 27, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxgb4: Signedness bug in init_one()

The "chip" variable is an enum, and it's treated as unsigned int by GCC in this context so the error handling isn't triggered.

Fixes e8d452923ae6 ("cxgb4: clean up init_one")
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +1 -1
index 71854a19cebe..38024877751c 100644
@@ -5701,7 +5701,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	whoami = t4_read_reg(adapter, PL_WHOAMI_A);
 	pci_read_config_word(pdev, PCI_DEVICE_ID, &device_id);
 	chip = t4_get_chip_type(adapter, CHELSIO_PCI_ID_VER(device_id));
-	if (chip < 0) {
+	if ((int)chip < 0) {
 		dev_err(&pdev->dev, "Device %d is not supported\n", device_id);
 		err = chip;
 		goto out_free_adapter;
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Wed, 25 Sep 2019 13:54:59 +0300

Quoted 5 lines

The "chip" variable is an enum, and it's treated as unsigned int by GCC in this context so the error handling isn't triggered.

Fixes e8d452923ae6 ("cxgb4: clean up init_one")

Applied.