From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Carolyn Wyborny <carolyn.wyborny@intel.com>,
netdev@vger.kernel.org, gospo@redhat.com, bphilips@novell.com,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next-2.6 03/24] igb: Fix strncpy calls to be safe per source code review tools
Date: Thu, 3 Mar 2011 05:03:28 -0800 [thread overview]
Message-ID: <1299157429-15878-4-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1299157429-15878-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Carolyn Wyborny <carolyn.wyborny@intel.com>
This fix changes the remaining calls to strncpy that have not yet
been changed to use the "sizeof(buf) - 1" syntax rather than just
a number for buffer size.
Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/igb/igb_ethtool.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index 16bbd49..61f7849 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -727,8 +727,9 @@ static void igb_get_drvinfo(struct net_device *netdev,
char firmware_version[32];
u16 eeprom_data;
- strncpy(drvinfo->driver, igb_driver_name, 32);
- strncpy(drvinfo->version, igb_driver_version, 32);
+ strncpy(drvinfo->driver, igb_driver_name, sizeof(drvinfo->driver) - 1);
+ strncpy(drvinfo->version, igb_driver_version,
+ sizeof(drvinfo->version) - 1);
/* EEPROM image version # is reported as firmware version # for
* 82575 controllers */
@@ -738,8 +739,10 @@ static void igb_get_drvinfo(struct net_device *netdev,
(eeprom_data & 0x0FF0) >> 4,
eeprom_data & 0x000F);
- strncpy(drvinfo->fw_version, firmware_version, 32);
- strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
+ strncpy(drvinfo->fw_version, firmware_version,
+ sizeof(drvinfo->fw_version) - 1);
+ strncpy(drvinfo->bus_info, pci_name(adapter->pdev),
+ sizeof(drvinfo->bus_info) - 1);
drvinfo->n_stats = IGB_STATS_LEN;
drvinfo->testinfo_len = IGB_TEST_LEN;
drvinfo->regdump_len = igb_get_regs_len(netdev);
--
1.7.4
next prev parent reply other threads:[~2011-03-03 13:04 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-03 13:03 [net-next-2.6 00/24][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 01/24] igb: warn if max_vfs limit is exceeded Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 02/24] igb: Fix reg pattern test in ethtool for i350 devices Jeff Kirsher
2011-03-03 13:03 ` Jeff Kirsher [this message]
2011-03-03 13:03 ` [net-next-2.6 04/24] ixgbevf: Fix Compiler Warnings Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 05/24] ixgbe: cleanup wake on LAN defines Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 06/24] ixgbe: cleanup logic related to HW semaphores Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 07/24] ixgbe: balance free_irq calls with request_irq calls Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 08/24] ixgbe: set media type for 82599 T3 LOM Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 09/24] ixgbe: Add ability to double reset on failure to clear master enable Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 10/24] ixgbe: cleanup code in ixgbe_identify_sfp_module_generic Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 11/24] ixgbe: Check link wants report current link state Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 12/24] ixgbe: add polling test to end of PHY reset Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 13/24] ixgbe: Fill out PCIe speed and width enums with values Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 14/24] ixgbe: Bounds checking for set_rar, clear_rar, set_vmdq, clear_vmdq Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 15/24] ixgbe: cleanup X540 PHY reset function pointer Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 16/24] ixgbe: rework ixgbe MTA handling to not drop packets Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 17/24] ixgbe: Drop unused code for setting up unicast addresses Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 18/24] ixgbe: Specific check for 100 Full link speed Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 19/24] ixgbe: Numerous whitespace / formatting cleanups Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 20/24] ixgbe: store permanent address before initializing Rx addresses Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 21/24] ixgbe: cleanup handling of I2C interface to PHY Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 22/24] ixgbe: X540 Cleanup Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 23/24] ixgbe: add function pointer for semaphore function Jeff Kirsher
2011-03-03 13:03 ` [net-next-2.6 24/24] ixgbe: cleanup copyright string for 2011 Jeff Kirsher
2011-03-03 19:30 ` [net-next-2.6 00/24][pull request] Intel Wired LAN Driver Updates David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1299157429-15878-4-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=bphilips@novell.com \
--cc=carolyn.wyborny@intel.com \
--cc=davem@davemloft.net \
--cc=gospo@redhat.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).