wireless: use strlcpy routine in .get_drvinfo
authorRick Jones <rick.jones2@hp.com>
Tue, 15 Nov 2011 18:40:49 +0000 (10:40 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 17 Nov 2011 20:44:50 +0000 (15:44 -0500)
Convert various seemingly still compiled wireless drivers' .get_drvinfo
routines to use the preferred strlcpy() routine.

Signed-off-by: Rick Jones <rick.jones2@hp.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/hostap/hostap_ioctl.c
drivers/net/wireless/ipw2x00/ipw2100.c
drivers/net/wireless/ipw2x00/ipw2200.c
drivers/net/wireless/libertas/ethtool.c
drivers/net/wireless/prism54/islpci_dev.c

index 12de46407c71ae42b7eb99e6f4e9d44888af2430..46a8c291c08a4b1df232d71564eddca8176389b5 100644 (file)
@@ -3871,8 +3871,8 @@ static void prism2_get_drvinfo(struct net_device *dev,
        iface = netdev_priv(dev);
        local = iface->local;
 
-       strncpy(info->driver, "hostap", sizeof(info->driver) - 1);
-       snprintf(info->fw_version, sizeof(info->fw_version) - 1,
+       strlcpy(info->driver, "hostap", sizeof(info->driver));
+       snprintf(info->fw_version, sizeof(info->fw_version),
                 "%d.%d.%d", (local->sta_fw_ver >> 16) & 0xff,
                 (local->sta_fw_ver >> 8) & 0xff,
                 local->sta_fw_ver & 0xff);
index 127e9c63beaf9be7737ccd104b72debf62f749df..a0e5c21d36576c74c1c402984a7392869926bdea 100644 (file)
@@ -5981,8 +5981,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
        struct ipw2100_priv *priv = libipw_priv(dev);
        char fw_ver[64], ucode_ver[64];
 
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
 
        ipw2100_get_fwversion(priv, fw_ver, sizeof(fw_ver));
        ipw2100_get_ucodeversion(priv, ucode_ver, sizeof(ucode_ver));
@@ -5990,7 +5990,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
        snprintf(info->fw_version, sizeof(info->fw_version), "%s:%d:%s",
                 fw_ver, priv->eeprom_version, ucode_ver);
 
-       strcpy(info->bus_info, pci_name(priv->pci_dev));
+       strlcpy(info->bus_info, pci_name(priv->pci_dev),
+               sizeof(info->bus_info));
 }
 
 static u32 ipw2100_ethtool_get_link(struct net_device *dev)
index 99575884ff525af70d69186ad625b55fb7d6dbdf..018a8deb88a83b5b2ab2febcc2487b89eeb4ba4f 100644 (file)
@@ -10548,8 +10548,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
        char date[32];
        u32 len;
 
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
 
        len = sizeof(vers);
        ipw_get_ordinal(p, IPW_ORD_STAT_FW_VERSION, vers, &len);
@@ -10558,7 +10558,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
 
        snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)",
                 vers, date);
-       strcpy(info->bus_info, pci_name(p->pci_dev));
+       strlcpy(info->bus_info, pci_name(p->pci_dev),
+               sizeof(info->bus_info));
        info->eedump_len = IPW_EEPROM_IMAGE_SIZE;
 }
 
index 885ddc1c4fed70d8b6a2a47042cba18016069c00..f955b2d66ed6e7609836e919678fc8c79d479b4b 100644 (file)
@@ -13,13 +13,14 @@ static void lbs_ethtool_get_drvinfo(struct net_device *dev,
 {
        struct lbs_private *priv = dev->ml_priv;
 
-       snprintf(info->fw_version, 32, "%u.%u.%u.p%u",
+       snprintf(info->fw_version, sizeof(info->fw_version),
+               "%u.%u.%u.p%u",
                priv->fwrelease >> 24 & 0xff,
                priv->fwrelease >> 16 & 0xff,
                priv->fwrelease >>  8 & 0xff,
                priv->fwrelease       & 0xff);
-       strcpy(info->driver, "libertas");
-       strcpy(info->version, lbs_driver_version);
+       strlcpy(info->driver, "libertas", sizeof(info->driver));
+       strlcpy(info->version, lbs_driver_version, sizeof(info->version));
 }
 
 /*
index 5d0f61508a2edd51fbf6a5b58b9c0f456a0f7df3..8a3cf4fe376f99e96a639a5c3b0ca1105fb71e8c 100644 (file)
@@ -793,8 +793,8 @@ islpci_set_multicast_list(struct net_device *dev)
 static void islpci_ethtool_get_drvinfo(struct net_device *dev,
                                        struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
 }
 
 static const struct ethtool_ops islpci_ethtool_ops = {