OSDN Git Service

net: move from strlcpy with unused retval to strscpy
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Tue, 30 Aug 2022 20:14:52 +0000 (22:14 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 31 Aug 2022 21:11:07 +0000 (14:11 -0700)
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> # for CAN
Link: https://lore.kernel.org/r/20220830201457.7984-1-wsa+renesas@sang-engineering.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
40 files changed:
drivers/net/Space.c
drivers/net/bonding/bond_main.c
drivers/net/can/sja1000/peak_pcmcia.c
drivers/net/can/usb/peak_usb/pcan_usb_core.c
drivers/net/dsa/b53/b53_common.c
drivers/net/dsa/bcm_sf2_cfp.c
drivers/net/dsa/hirschmann/hellcreek.c
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dummy.c
drivers/net/fjes/fjes_ethtool.c
drivers/net/geneve.c
drivers/net/hamradio/hdlcdrv.c
drivers/net/hyperv/netvsc_drv.c
drivers/net/ipvlan/ipvlan_main.c
drivers/net/macvlan.c
drivers/net/net_failover.c
drivers/net/netconsole.c
drivers/net/ntb_netdev.c
drivers/net/phy/adin.c
drivers/net/phy/bcm-phy-lib.c
drivers/net/phy/marvell.c
drivers/net/phy/micrel.c
drivers/net/phy/mscc/mscc_main.c
drivers/net/phy/phy_device.c
drivers/net/rionet.c
drivers/net/team/team.c
drivers/net/tun.c
drivers/net/usb/aqc111.c
drivers/net/usb/asix_common.c
drivers/net/usb/catc.c
drivers/net/usb/pegasus.c
drivers/net/usb/r8152.c
drivers/net/usb/rtl8150.c
drivers/net/usb/sierra_net.c
drivers/net/usb/usbnet.c
drivers/net/veth.c
drivers/net/virtio_net.c
drivers/net/vmxnet3/vmxnet3_ethtool.c
drivers/net/vrf.c
drivers/net/vxlan/vxlan_core.c

index f475eef..83214e2 100644 (file)
@@ -68,7 +68,7 @@ static int netdev_boot_setup_add(char *name, struct ifmap *map)
        for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) {
                if (s[i].name[0] == '\0' || s[i].name[0] == ' ') {
                        memset(s[i].name, 0, sizeof(s[i].name));
-                       strlcpy(s[i].name, name, IFNAMSIZ);
+                       strscpy(s[i].name, name, IFNAMSIZ);
                        memcpy(&s[i].map, map, sizeof(s[i].map));
                        break;
                }
index 2f4da2c..dc618bf 100644 (file)
@@ -5619,7 +5619,7 @@ static int bond_ethtool_get_link_ksettings(struct net_device *bond_dev,
 static void bond_ethtool_get_drvinfo(struct net_device *bond_dev,
                                     struct ethtool_drvinfo *drvinfo)
 {
-       strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
+       strscpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
        snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d",
                 BOND_ABI_VERSION);
 }
index 131a084..ebd5941 100644 (file)
@@ -478,7 +478,7 @@ static void pcan_free_channels(struct pcan_pccard *card)
                if (!netdev)
                        continue;
 
-               strlcpy(name, netdev->name, IFNAMSIZ);
+               strscpy(name, netdev->name, IFNAMSIZ);
 
                unregister_sja1000dev(netdev);
 
index 8c9d53f..225697d 100644 (file)
@@ -962,7 +962,7 @@ static void peak_usb_disconnect(struct usb_interface *intf)
 
                dev_prev_siblings = dev->prev_siblings;
                dev->state &= ~PCAN_USB_STATE_CONNECTED;
-               strlcpy(name, netdev->name, IFNAMSIZ);
+               strscpy(name, netdev->name, IFNAMSIZ);
 
                unregister_netdev(netdev);
 
index 48cf344..59cdfc5 100644 (file)
@@ -972,7 +972,7 @@ void b53_get_strings(struct dsa_switch *ds, int port, u32 stringset,
 
        if (stringset == ETH_SS_STATS) {
                for (i = 0; i < mib_size; i++)
-                       strlcpy(data + i * ETH_GSTRING_LEN,
+                       strscpy(data + i * ETH_GSTRING_LEN,
                                mibs[i].name, ETH_GSTRING_LEN);
        } else if (stringset == ETH_SS_PHY_STATS) {
                phydev = b53_get_phy_device(ds, port);
index edbe5e7..22bc295 100644 (file)
@@ -1296,7 +1296,7 @@ void bcm_sf2_cfp_get_strings(struct dsa_switch *ds, int port,
                                 "CFP%03d_%sCntr",
                                 i, bcm_sf2_cfp_stats[j].name);
                        iter = (i - 1) * s + j;
-                       strlcpy(data + iter * ETH_GSTRING_LEN,
+                       strscpy(data + iter * ETH_GSTRING_LEN,
                                buf, ETH_GSTRING_LEN);
                }
        }
index 01f9099..ea8bbfc 100644 (file)
@@ -288,7 +288,7 @@ static void hellcreek_get_strings(struct dsa_switch *ds, int port,
        for (i = 0; i < ARRAY_SIZE(hellcreek_counter); ++i) {
                const struct hellcreek_counter *counter = &hellcreek_counter[i];
 
-               strlcpy(data + i * ETH_GSTRING_LEN,
+               strscpy(data + i * ETH_GSTRING_LEN,
                        counter->name, ETH_GSTRING_LEN);
        }
 }
index 6403f1f..6f4ea39 100644 (file)
@@ -1136,7 +1136,7 @@ static void mv88e6xxx_atu_vtu_get_strings(uint8_t *data)
        unsigned int i;
 
        for (i = 0; i < ARRAY_SIZE(mv88e6xxx_atu_vtu_stats_strings); i++)
-               strlcpy(data + i * ETH_GSTRING_LEN,
+               strscpy(data + i * ETH_GSTRING_LEN,
                        mv88e6xxx_atu_vtu_stats_strings[i],
                        ETH_GSTRING_LEN);
 }
index f82ad74..aa0fc00 100644 (file)
@@ -102,7 +102,7 @@ static const struct net_device_ops dummy_netdev_ops = {
 static void dummy_get_drvinfo(struct net_device *dev,
                              struct ethtool_drvinfo *info)
 {
-       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strscpy(info->driver, DRV_NAME, sizeof(info->driver));
 }
 
 static const struct ethtool_ops dummy_ethtool_ops = {
index 746736c..19c9952 100644 (file)
@@ -151,11 +151,11 @@ static void fjes_get_drvinfo(struct net_device *netdev,
 
        plat_dev = adapter->plat_dev;
 
-       strlcpy(drvinfo->driver, fjes_driver_name, sizeof(drvinfo->driver));
-       strlcpy(drvinfo->version, fjes_driver_version,
+       strscpy(drvinfo->driver, fjes_driver_name, sizeof(drvinfo->driver));
+       strscpy(drvinfo->version, fjes_driver_version,
                sizeof(drvinfo->version));
 
-       strlcpy(drvinfo->fw_version, "none", sizeof(drvinfo->fw_version));
+       strscpy(drvinfo->fw_version, "none", sizeof(drvinfo->fw_version));
        snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
                 "platform:%s", plat_dev->name);
 }
index 01aa947..f393e45 100644 (file)
@@ -1197,8 +1197,8 @@ static const struct net_device_ops geneve_netdev_ops = {
 static void geneve_get_drvinfo(struct net_device *dev,
                               struct ethtool_drvinfo *drvinfo)
 {
-       strlcpy(drvinfo->version, GENEVE_NETDEV_VER, sizeof(drvinfo->version));
-       strlcpy(drvinfo->driver, "geneve", sizeof(drvinfo->driver));
+       strscpy(drvinfo->version, GENEVE_NETDEV_VER, sizeof(drvinfo->version));
+       strscpy(drvinfo->driver, "geneve", sizeof(drvinfo->driver));
 }
 
 static const struct ethtool_ops geneve_ethtool_ops = {
index 8297411..a6184d6 100644 (file)
@@ -600,7 +600,7 @@ static int hdlcdrv_siocdevprivate(struct net_device *dev, struct ifreq *ifr,
 
        case HDLCDRVCTL_DRIVERNAME:
                if (s->ops && s->ops->drvname) {
-                       strlcpy(bi.data.drivername, s->ops->drvname,
+                       strscpy(bi.data.drivername, s->ops->drvname,
                                sizeof(bi.data.drivername));
                        break;
                }
index 15ebd54..5f08482 100644 (file)
@@ -935,8 +935,8 @@ int netvsc_recv_callback(struct net_device *net,
 static void netvsc_get_drvinfo(struct net_device *net,
                               struct ethtool_drvinfo *info)
 {
-       strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
-       strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
+       strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
+       strscpy(info->fw_version, "N/A", sizeof(info->fw_version));
 }
 
 static void netvsc_get_channels(struct net_device *net,
index 49ba8a5..54c94a6 100644 (file)
@@ -408,8 +408,8 @@ static int ipvlan_ethtool_get_link_ksettings(struct net_device *dev,
 static void ipvlan_ethtool_get_drvinfo(struct net_device *dev,
                                       struct ethtool_drvinfo *drvinfo)
 {
-       strlcpy(drvinfo->driver, IPVLAN_DRV, sizeof(drvinfo->driver));
-       strlcpy(drvinfo->version, IPV_DRV_VER, sizeof(drvinfo->version));
+       strscpy(drvinfo->driver, IPVLAN_DRV, sizeof(drvinfo->driver));
+       strscpy(drvinfo->version, IPV_DRV_VER, sizeof(drvinfo->version));
 }
 
 static u32 ipvlan_ethtool_get_msglevel(struct net_device *dev)
index 1080d6e..713e335 100644 (file)
@@ -1043,8 +1043,8 @@ static int macvlan_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
 static void macvlan_ethtool_get_drvinfo(struct net_device *dev,
                                        struct ethtool_drvinfo *drvinfo)
 {
-       strlcpy(drvinfo->driver, "macvlan", sizeof(drvinfo->driver));
-       strlcpy(drvinfo->version, "0.1", sizeof(drvinfo->version));
+       strscpy(drvinfo->driver, "macvlan", sizeof(drvinfo->driver));
+       strscpy(drvinfo->version, "0.1", sizeof(drvinfo->version));
 }
 
 static int macvlan_ethtool_get_link_ksettings(struct net_device *dev,
index 21a0435..7a28e08 100644 (file)
@@ -324,8 +324,8 @@ static const struct net_device_ops failover_dev_ops = {
 static void nfo_ethtool_get_drvinfo(struct net_device *dev,
                                    struct ethtool_drvinfo *drvinfo)
 {
-       strlcpy(drvinfo->driver, FAILOVER_NAME, sizeof(drvinfo->driver));
-       strlcpy(drvinfo->version, FAILOVER_VERSION, sizeof(drvinfo->version));
+       strscpy(drvinfo->driver, FAILOVER_NAME, sizeof(drvinfo->driver));
+       strscpy(drvinfo->version, FAILOVER_VERSION, sizeof(drvinfo->version));
 }
 
 static int nfo_ethtool_get_link_ksettings(struct net_device *dev,
index ddac61d..bdff9ac 100644 (file)
@@ -55,7 +55,7 @@ MODULE_PARM_DESC(oops_only, "Only log oops messages");
 #ifndef        MODULE
 static int __init option_setup(char *opt)
 {
-       strlcpy(config, opt, MAX_PARAM_LENGTH);
+       strscpy(config, opt, MAX_PARAM_LENGTH);
        return 1;
 }
 __setup("netconsole=", option_setup);
@@ -178,7 +178,7 @@ static struct netconsole_target *alloc_param_target(char *target_config)
                goto fail;
 
        nt->np.name = "netconsole";
-       strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ);
+       strscpy(nt->np.dev_name, "eth0", IFNAMSIZ);
        nt->np.local_port = 6665;
        nt->np.remote_port = 6666;
        eth_broadcast_addr(nt->np.remote_mac);
@@ -414,7 +414,7 @@ static ssize_t dev_name_store(struct config_item *item, const char *buf,
                return -EINVAL;
        }
 
-       strlcpy(nt->np.dev_name, buf, IFNAMSIZ);
+       strscpy(nt->np.dev_name, buf, IFNAMSIZ);
 
        /* Get rid of possible trailing newline from echo(1) */
        len = strnlen(nt->np.dev_name, IFNAMSIZ);
@@ -630,7 +630,7 @@ static struct config_item *make_netconsole_target(struct config_group *group,
                return ERR_PTR(-ENOMEM);
 
        nt->np.name = "netconsole";
-       strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ);
+       strscpy(nt->np.dev_name, "eth0", IFNAMSIZ);
        nt->np.local_port = 6665;
        nt->np.remote_port = 6666;
        eth_broadcast_addr(nt->np.remote_mac);
@@ -708,7 +708,7 @@ restart:
                if (nt->np.dev == dev) {
                        switch (event) {
                        case NETDEV_CHANGENAME:
-                               strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ);
+                               strscpy(nt->np.dev_name, dev->name, IFNAMSIZ);
                                break;
                        case NETDEV_RELEASE:
                        case NETDEV_JOIN:
index 80bdc07..464d88c 100644 (file)
@@ -364,9 +364,9 @@ static void ntb_get_drvinfo(struct net_device *ndev,
 {
        struct ntb_netdev *dev = netdev_priv(ndev);
 
-       strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
-       strlcpy(info->version, NTB_NETDEV_VER, sizeof(info->version));
-       strlcpy(info->bus_info, pci_name(dev->pdev), sizeof(info->bus_info));
+       strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
+       strscpy(info->version, NTB_NETDEV_VER, sizeof(info->version));
+       strscpy(info->bus_info, pci_name(dev->pdev), sizeof(info->bus_info));
 }
 
 static int ntb_get_link_ksettings(struct net_device *dev,
index ee374a8..1346375 100644 (file)
@@ -749,7 +749,7 @@ static void adin_get_strings(struct phy_device *phydev, u8 *data)
        int i;
 
        for (i = 0; i < ARRAY_SIZE(adin_hw_stats); i++) {
-               strlcpy(&data[i * ETH_GSTRING_LEN],
+               strscpy(&data[i * ETH_GSTRING_LEN],
                        adin_hw_stats[i].string, ETH_GSTRING_LEN);
        }
 }
index 287cccf..b2c0baa 100644 (file)
@@ -519,7 +519,7 @@ void bcm_phy_get_strings(struct phy_device *phydev, u8 *data)
        unsigned int i;
 
        for (i = 0; i < ARRAY_SIZE(bcm_phy_hw_stats); i++)
-               strlcpy(data + i * ETH_GSTRING_LEN,
+               strscpy(data + i * ETH_GSTRING_LEN,
                        bcm_phy_hw_stats[i].string, ETH_GSTRING_LEN);
 }
 EXPORT_SYMBOL_GPL(bcm_phy_get_strings);
index a714150..a3e8107 100644 (file)
@@ -1952,7 +1952,7 @@ static void marvell_get_strings(struct phy_device *phydev, u8 *data)
        int i;
 
        for (i = 0; i < count; i++) {
-               strlcpy(data + i * ETH_GSTRING_LEN,
+               strscpy(data + i * ETH_GSTRING_LEN,
                        marvell_hw_stats[i].string, ETH_GSTRING_LEN);
        }
 }
index e78d0bf..1630163 100644 (file)
@@ -1650,7 +1650,7 @@ static void kszphy_get_strings(struct phy_device *phydev, u8 *data)
        int i;
 
        for (i = 0; i < ARRAY_SIZE(kszphy_hw_stats); i++) {
-               strlcpy(data + i * ETH_GSTRING_LEN,
+               strscpy(data + i * ETH_GSTRING_LEN,
                        kszphy_hw_stats[i].string, ETH_GSTRING_LEN);
        }
 }
index 7e3017e..8a13b1a 100644 (file)
@@ -136,7 +136,7 @@ static void vsc85xx_get_strings(struct phy_device *phydev, u8 *data)
                return;
 
        for (i = 0; i < priv->nstats; i++)
-               strlcpy(data + i * ETH_GSTRING_LEN, priv->hw_stats[i].string,
+               strscpy(data + i * ETH_GSTRING_LEN, priv->hw_stats[i].string,
                        ETH_GSTRING_LEN);
 }
 
index 12ff276..2198f13 100644 (file)
@@ -370,7 +370,7 @@ int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
        if (!fixup)
                return -ENOMEM;
 
-       strlcpy(fixup->bus_id, bus_id, sizeof(fixup->bus_id));
+       strscpy(fixup->bus_id, bus_id, sizeof(fixup->bus_id));
        fixup->phy_uid = phy_uid;
        fixup->phy_uid_mask = phy_uid_mask;
        fixup->run = run;
index 39e61e0..fbcb9d0 100644 (file)
@@ -443,10 +443,10 @@ static void rionet_get_drvinfo(struct net_device *ndev,
 {
        struct rionet_private *rnet = netdev_priv(ndev);
 
-       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
-       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
-       strlcpy(info->fw_version, "n/a", sizeof(info->fw_version));
-       strlcpy(info->bus_info, rnet->mport->name, sizeof(info->bus_info));
+       strscpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strscpy(info->version, DRV_VERSION, sizeof(info->version));
+       strscpy(info->fw_version, "n/a", sizeof(info->fw_version));
+       strscpy(info->bus_info, rnet->mport->name, sizeof(info->bus_info));
 }
 
 static u32 rionet_get_msglevel(struct net_device *ndev)
index b1e1239..ab92416 100644 (file)
@@ -2070,8 +2070,8 @@ static const struct net_device_ops team_netdev_ops = {
 static void team_ethtool_get_drvinfo(struct net_device *dev,
                                     struct ethtool_drvinfo *drvinfo)
 {
-       strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
-       strlcpy(drvinfo->version, UTS_RELEASE, sizeof(drvinfo->version));
+       strscpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
+       strscpy(drvinfo->version, UTS_RELEASE, sizeof(drvinfo->version));
 }
 
 static int team_ethtool_get_link_ksettings(struct net_device *dev,
index 259b2b8..3732e51 100644 (file)
@@ -3540,15 +3540,15 @@ static void tun_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info
 {
        struct tun_struct *tun = netdev_priv(dev);
 
-       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
-       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strscpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strscpy(info->version, DRV_VERSION, sizeof(info->version));
 
        switch (tun->flags & TUN_TYPE_MASK) {
        case IFF_TUN:
-               strlcpy(info->bus_info, "tun", sizeof(info->bus_info));
+               strscpy(info->bus_info, "tun", sizeof(info->bus_info));
                break;
        case IFF_TAP:
-               strlcpy(info->bus_info, "tap", sizeof(info->bus_info));
+               strscpy(info->bus_info, "tap", sizeof(info->bus_info));
                break;
        }
 }
index 3020e81..a017e9d 100644 (file)
@@ -201,7 +201,7 @@ static void aqc111_get_drvinfo(struct net_device *net,
 
        /* Inherit standard device info */
        usbnet_get_drvinfo(net, info);
-       strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
+       strscpy(info->driver, DRIVER_NAME, sizeof(info->driver));
        snprintf(info->fw_version, sizeof(info->fw_version), "%u.%u.%u",
                 aqc111_data->fw_ver.major,
                 aqc111_data->fw_ver.minor,
index 9ea91c3..72ffc89 100644 (file)
@@ -752,8 +752,8 @@ void asix_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info)
 {
        /* Inherit standard device info */
        usbnet_get_drvinfo(net, info);
-       strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
-       strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
+       strscpy(info->driver, DRIVER_NAME, sizeof(info->driver));
+       strscpy(info->version, DRIVER_VERSION, sizeof(info->version));
 }
 
 int asix_set_mac_address(struct net_device *net, void *p)
index 8438934..ff439ef 100644 (file)
@@ -672,8 +672,8 @@ static void catc_get_drvinfo(struct net_device *dev,
                             struct ethtool_drvinfo *info)
 {
        struct catc *catc = netdev_priv(dev);
-       strlcpy(info->driver, driver_name, sizeof(info->driver));
-       strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
+       strscpy(info->driver, driver_name, sizeof(info->driver));
+       strscpy(info->version, DRIVER_VERSION, sizeof(info->version));
        usb_make_path(catc->usbdev, info->bus_info, sizeof(info->bus_info));
 }
 
index feb247e..81ca64d 100644 (file)
@@ -894,7 +894,7 @@ static void pegasus_get_drvinfo(struct net_device *dev,
 {
        pegasus_t *pegasus = netdev_priv(dev);
 
-       strlcpy(info->driver, driver_name, sizeof(info->driver));
+       strscpy(info->driver, driver_name, sizeof(info->driver));
        usb_make_path(pegasus->usb, info->bus_info, sizeof(info->bus_info));
 }
 
index 688905e..45dcc3f 100644 (file)
@@ -8602,11 +8602,11 @@ static void rtl8152_get_drvinfo(struct net_device *netdev,
 {
        struct r8152 *tp = netdev_priv(netdev);
 
-       strlcpy(info->driver, MODULENAME, sizeof(info->driver));
-       strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
+       strscpy(info->driver, MODULENAME, sizeof(info->driver));
+       strscpy(info->version, DRIVER_VERSION, sizeof(info->version));
        usb_make_path(tp->udev, info->bus_info, sizeof(info->bus_info));
        if (!IS_ERR_OR_NULL(tp->rtl_fw.fw))
-               strlcpy(info->fw_version, tp->rtl_fw.version,
+               strscpy(info->fw_version, tp->rtl_fw.version,
                        sizeof(info->fw_version));
 }
 
index 3d2bf2a..97afd73 100644 (file)
@@ -769,8 +769,8 @@ static void rtl8150_get_drvinfo(struct net_device *netdev, struct ethtool_drvinf
 {
        rtl8150_t *dev = netdev_priv(netdev);
 
-       strlcpy(info->driver, driver_name, sizeof(info->driver));
-       strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
+       strscpy(info->driver, driver_name, sizeof(info->driver));
+       strscpy(info->version, DRIVER_VERSION, sizeof(info->version));
        usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info));
 }
 
index bb4cbe8..b3ae949 100644 (file)
@@ -612,8 +612,8 @@ static void sierra_net_get_drvinfo(struct net_device *net,
 {
        /* Inherit standard device info */
        usbnet_get_drvinfo(net, info);
-       strlcpy(info->driver, driver_name, sizeof(info->driver));
-       strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
+       strscpy(info->driver, driver_name, sizeof(info->driver));
+       strscpy(info->version, DRIVER_VERSION, sizeof(info->version));
 }
 
 static u32 sierra_net_get_link(struct net_device *net)
index aaa89b4..fd399a8 100644 (file)
@@ -1050,9 +1050,9 @@ void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
 {
        struct usbnet *dev = netdev_priv(net);
 
-       strlcpy (info->driver, dev->driver_name, sizeof info->driver);
-       strlcpy (info->fw_version, dev->driver_info->description,
-               sizeof info->fw_version);
+       strscpy(info->driver, dev->driver_name, sizeof(info->driver));
+       strscpy(info->fw_version, dev->driver_info->description,
+               sizeof(info->fw_version));
        usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info);
 }
 EXPORT_SYMBOL_GPL(usbnet_get_drvinfo);
index 466da01..550c85a 100644 (file)
@@ -128,8 +128,8 @@ static int veth_get_link_ksettings(struct net_device *dev,
 
 static void veth_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
-       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strscpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strscpy(info->version, DRV_VERSION, sizeof(info->version));
 }
 
 static void veth_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
index 9cce7de..e0e5708 100644 (file)
@@ -2594,9 +2594,9 @@ static void virtnet_get_drvinfo(struct net_device *dev,
        struct virtnet_info *vi = netdev_priv(dev);
        struct virtio_device *vdev = vi->vdev;
 
-       strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
-       strlcpy(info->version, VIRTNET_DRIVER_VERSION, sizeof(info->version));
-       strlcpy(info->bus_info, virtio_bus_name(vdev), sizeof(info->bus_info));
+       strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
+       strscpy(info->version, VIRTNET_DRIVER_VERSION, sizeof(info->version));
+       strscpy(info->bus_info, virtio_bus_name(vdev), sizeof(info->bus_info));
 
 }
 
index e2034ad..18cf7c7 100644 (file)
@@ -209,12 +209,12 @@ vmxnet3_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
 {
        struct vmxnet3_adapter *adapter = netdev_priv(netdev);
 
-       strlcpy(drvinfo->driver, vmxnet3_driver_name, sizeof(drvinfo->driver));
+       strscpy(drvinfo->driver, vmxnet3_driver_name, sizeof(drvinfo->driver));
 
-       strlcpy(drvinfo->version, VMXNET3_DRIVER_VERSION_REPORT,
+       strscpy(drvinfo->version, VMXNET3_DRIVER_VERSION_REPORT,
                sizeof(drvinfo->version));
 
-       strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
+       strscpy(drvinfo->bus_info, pci_name(adapter->pdev),
                sizeof(drvinfo->bus_info));
 }
 
index 5df7a0a..badf6f0 100644 (file)
@@ -1541,8 +1541,8 @@ static const struct l3mdev_ops vrf_l3mdev_ops = {
 static void vrf_get_drvinfo(struct net_device *dev,
                            struct ethtool_drvinfo *info)
 {
-       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
-       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strscpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strscpy(info->version, DRV_VERSION, sizeof(info->version));
 }
 
 static const struct ethtool_ops vrf_ethtool_ops = {
index 1a47d04..6ab669d 100644 (file)
@@ -3310,8 +3310,8 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[],
 static void vxlan_get_drvinfo(struct net_device *netdev,
                              struct ethtool_drvinfo *drvinfo)
 {
-       strlcpy(drvinfo->version, VXLAN_VERSION, sizeof(drvinfo->version));
-       strlcpy(drvinfo->driver, "vxlan", sizeof(drvinfo->driver));
+       strscpy(drvinfo->version, VXLAN_VERSION, sizeof(drvinfo->version));
+       strscpy(drvinfo->driver, "vxlan", sizeof(drvinfo->driver));
 }
 
 static int vxlan_get_link_ksettings(struct net_device *dev,