qlcnic: off by one in qlcnic_init_pci_info()
PATCH 1/1 qlcnic: off by one in qlcnic_init_pci_info()
The adapter->npars[] array has QLCNIC_MAX_PCI_FUNC elements. We allocate it that way a few lines earlier in the function. So this test is off by one.
Signed-off-by Dan Carpenter <[email protected]>
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +1 -1
@@ -479,7 +479,7 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter)for (i =0 ; i <QLCNIC_MAX_PCI_FUNC ; i++) { pfn = pci_info[i].id; -if (pfn >QLCNIC_MAX_PCI_FUNC ) { +if (pfn >=QLCNIC_MAX_PCI_FUNC ) { ret =QL_STATUS_INVALID_PARAM ; goto err_eswitch; }
Quoted 12 lines · Dan Carpenter
The adapter->npars[] array has
QLCNIC_MAX_PCI_FUNCelements. We allocate it that way a few lines earlier in the function. So this test is off by one.Signed-off-by Dan Carpenter <[email protected]>drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +0
-0
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c qlcnic_init_pci_info(struct qlcnic_adapter *adapter) · line 485
Quoted 8 lines
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +1
-1@@ -479,7 +479,7 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter)for (i =0 ; i <QLCNIC_MAX_PCI_FUNC ; i++) { pfn = pci_info[i].id; -if (pfn >QLCNIC_MAX_PCI_FUNC ) { +if (pfn >=QLCNIC_MAX_PCI_FUNC ) { ret =QL_STATUS_INVALID_PARAM ; goto err_eswitch; }
Thanks for the patch.
From: Anirban Chakraborty <[email protected]>
Date: Thu, 14 Jun 2012 21:03:14 -0700
Quoted 9 lines · Dan Carpenter
Quoted 6 lines
The adapter->npars[] array has
QLCNIC_MAX_PCI_FUNCelements. We allocate it that way a few lines earlier in the function. So this test is off by one.Signed-off-by Dan Carpenter <[email protected]>
...
Quoted 1 line
Applied.