[patch] qlcnic: off by one in qlcnic_init_pci_info()

Subsystems: networking drivers, qlogic qlcnic (1/10)gb ethernet driver, the rest

STALE5180d

3 messages, 3 authors, 2012-06-15 · open the first message on its own page

[patch] qlcnic: off by one in qlcnic_init_pci_info()

From: Dan Carpenter <hidden>
Date: 2012-06-14 18:34:38

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 <redacted>
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 33c3e46..212c121 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -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;
 		}

Re: [patch] qlcnic: off by one in qlcnic_init_pci_info()

From: Anirban Chakraborty <hidden>
Date: 2012-06-15 04:03:22


On 6/14/12 11:34 AM, "Dan Carpenter" [off-list ref] wrote:
quoted hunk
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 <redacted>
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 33c3e46..212c121 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -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.

Acked-by: Anirban Chakraborty <redacted>

Re: [patch] qlcnic: off by one in qlcnic_init_pci_info()

From: David Miller <davem@davemloft.net>
Date: 2012-06-15 22:31:40

From: Anirban Chakraborty <redacted>
Date: Thu, 14 Jun 2012 21:03:14 -0700

On 6/14/12 11:34 AM, "Dan Carpenter" [off-list ref] wrote:
quoted
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 <redacted>
 ...
Acked-by: Anirban Chakraborty <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help