Patchwork [v2] qlcnic: silence false positive overflow warning

login
register
mail settings
Submitter Dan Carpenter
Date Jan. 31, 2013, 8:14 a.m.
Message ID <20130131081410.GA14542@elgon.mountain>
Download mbox | patch
Permalink /patch/217118/
State Accepted
Delegated to: David Miller
Headers show

Comments

Dan Carpenter - Jan. 31, 2013, 8:14 a.m.
We actually store the MAC address as well as the board_name here.  The
longest board_name is 75 characters so there is more than enough room
to hold the 17 character MAC and the ": " divider.  But making this
buffer larger silences a static checker warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-By: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
---
v2: Rebased on current net-next.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Feb. 3, 2013, 4 a.m.
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Thu, 31 Jan 2013 11:14:10 +0300

> We actually store the MAC address as well as the board_name here.  The
> longest board_name is 75 characters so there is more than enough room
> to hold the 17 character MAC and the ": " divider.  But making this
> buffer larger silences a static checker warning.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-By: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>

Applied, thanks Dan.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index f3deef0..6a59a11 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -1813,7 +1813,7 @@  qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	struct qlcnic_hardware_context *ahw;
 	int err, pci_using_dac = -1;
 	u32 capab2;
-	char board_name[QLCNIC_MAX_BOARD_NAME_LEN];
+	char board_name[QLCNIC_MAX_BOARD_NAME_LEN + 19]; /* MAC + ": " + name */
 
 	err = pci_enable_device(pdev);
 	if (err)