From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
To: davem@davemloft.net
Cc: Don Skidmore <donald.c.skidmore@intel.com>,
netdev@vger.kernel.org, gospo@redhat.com, bphilips@novell.com,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [PATCH 14/27] ixgbe: cleanup string function calls to use bound checking versions.
Date: Fri, 10 Dec 2010 22:19:01 -0800 [thread overview]
Message-ID: <1292048354-22076-3-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1292048354-22076-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Don Skidmore <donald.c.skidmore@intel.com>
Some minor cleanup to use string calls that use bound checks just to
be extra safe.
Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ixgbe/ixgbe_ethtool.c | 5 +++--
drivers/net/ixgbe/ixgbe_main.c | 16 ++++++++--------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index f2245ac..23ff23e 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -839,9 +839,10 @@ static void ixgbe_get_drvinfo(struct net_device *netdev,
struct ixgbe_adapter *adapter = netdev_priv(netdev);
char firmware_version[32];
- strncpy(drvinfo->driver, ixgbe_driver_name, sizeof(drvinfo->driver));
+ strncpy(drvinfo->driver, ixgbe_driver_name,
+ sizeof(drvinfo->driver) - 1);
strncpy(drvinfo->version, ixgbe_driver_version,
- sizeof(drvinfo->version));
+ sizeof(drvinfo->version) - 1);
snprintf(firmware_version, sizeof(firmware_version), "%d.%d-%d",
(adapter->eeprom_version & 0xF000) >> 12,
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index f2694f2..8af0fc0 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2338,14 +2338,14 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter)
handler = SET_HANDLER(q_vector);
if (handler == &ixgbe_msix_clean_rx) {
- sprintf(q_vector->name, "%s-%s-%d",
- netdev->name, "rx", ri++);
+ snprintf(q_vector->name, sizeof(q_vector->name) - 1,
+ "%s-%s-%d", netdev->name, "rx", ri++);
} else if (handler == &ixgbe_msix_clean_tx) {
- sprintf(q_vector->name, "%s-%s-%d",
- netdev->name, "tx", ti++);
+ snprintf(q_vector->name, sizeof(q_vector->name) - 1,
+ "%s-%s-%d", netdev->name, "tx", ti++);
} else if (handler == &ixgbe_msix_clean_many) {
- sprintf(q_vector->name, "%s-%s-%d",
- netdev->name, "TxRx", ri++);
+ snprintf(q_vector->name, sizeof(q_vector->name) - 1,
+ "%s-%s-%d", netdev->name, "TxRx", ri++);
ti++;
} else {
/* skip this unused q_vector */
@@ -7047,7 +7047,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
netdev->netdev_ops = &ixgbe_netdev_ops;
ixgbe_set_ethtool_ops(netdev);
netdev->watchdog_timeo = 5 * HZ;
- strcpy(netdev->name, pci_name(pdev));
+ strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
adapter->bd_number = cards_found;
@@ -7269,7 +7269,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
err = ixgbe_read_pba_string_generic(hw, part_str, IXGBE_PBANUM_LENGTH);
if (err)
- strcpy(part_str, "Unknown");
+ strncpy(part_str, "Unknown", IXGBE_PBANUM_LENGTH);
if (ixgbe_is_sfp(hw) && hw->phy.sfp_type != ixgbe_sfp_type_not_present)
e_dev_info("MAC: %d, PHY: %d, SFP+: %d, PBA No: %s\n",
hw->mac.type, hw->phy.type, hw->phy.sfp_type,
--
1.7.3.2
next prev parent reply other threads:[~2010-12-11 6:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-11 6:18 [PATCH 12/27] ixgbe: fix X540 to use it's own info struct Jeff Kirsher
2010-12-11 6:19 ` [PATCH 13/27] ixgbe: fix ntuple support Jeff Kirsher
2010-12-11 6:19 ` Jeff Kirsher [this message]
2010-12-11 6:19 ` [PATCH 15/27] e1000e: fix double initialization in blink path Jeff Kirsher
2010-12-11 6:19 ` [PATCH 16/27] e1000e: 82571-based mezzanine card can fail ethtool link test Jeff Kirsher
2010-12-11 6:19 ` [PATCH 17/27] e1000e: 82574/82583 performance improvement Jeff Kirsher
2010-12-11 6:19 ` [PATCH 18/27] e1000e: 82577/8 must acquire h/w semaphore before workaround Jeff Kirsher
2010-12-11 6:19 ` [PATCH 19/27] e1000e: 82571 Serdes can fail to get link Jeff Kirsher
2010-12-11 6:19 ` [PATCH 20/27] e1000e: 82577/8/9 mis-configured OEM bits during S0->Sx Jeff Kirsher
2010-12-11 6:19 ` [PATCH 21/27] e1000e: 82579 PHY incorrectly identified during init Jeff Kirsher
2010-12-11 6:19 ` [PATCH 22/27] e1000e: support new PBA format from EEPROM Jeff Kirsher
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=1292048354-22076-3-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=bphilips@novell.com \
--cc=davem@davemloft.net \
--cc=donald.c.skidmore@intel.com \
--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).