]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ixgbe: cleanup string function calls to use bound checking versions.
authorDon Skidmore <donald.c.skidmore@intel.com>
Fri, 3 Dec 2010 09:33:54 +0000 (09:33 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Sat, 11 Dec 2010 06:12:58 +0000 (22:12 -0800)
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
drivers/net/ixgbe/ixgbe_main.c

index f2245ac750344a0c590c4d8a652ad59882930356..23ff23e8b39396231b32eb360129b67a85bb197e 100644 (file)
@@ -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,
index f2694f2b127adf5270357de0e9b9c528cc36f9bb..8af0fc0516962299bc9fc94f59469f998130b89f 100644 (file)
@@ -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,