diff options
author | Jiri Pirko <jiri@resnulli.us> | 2013-01-05 19:44:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-07 00:06:31 -0500 |
commit | 7826d43f2db45c9305a6e0ba165650e1a203f517 (patch) | |
tree | a8659c995a37f58db809da9537aafac178431f31 /drivers/usb/gadget | |
parent | 2afb9b533423a9b97f84181e773cf9361d98fed6 (diff) |
ethtool: fix drvinfo strings set in drivers
Use strlcpy where possible to ensure the string is \0 terminated.
Use always sizeof(string) instead of 32, ETHTOOL_BUSINFO_LEN
and custom defines.
Use snprintf instead of sprint.
Remove unnecessary inits of ->fw_version
Remove unnecessary inits of drvinfo struct.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/u_ether.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index 4ec3c0d7a18b..a0aa721d8b21 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c | |||
@@ -159,12 +159,12 @@ static int ueth_change_mtu(struct net_device *net, int new_mtu) | |||
159 | 159 | ||
160 | static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p) | 160 | static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p) |
161 | { | 161 | { |
162 | struct eth_dev *dev = netdev_priv(net); | 162 | struct eth_dev *dev = netdev_priv(net); |
163 | 163 | ||
164 | strlcpy(p->driver, "g_ether", sizeof p->driver); | 164 | strlcpy(p->driver, "g_ether", sizeof(p->driver)); |
165 | strlcpy(p->version, UETH__VERSION, sizeof p->version); | 165 | strlcpy(p->version, UETH__VERSION, sizeof(p->version)); |
166 | strlcpy(p->fw_version, dev->gadget->name, sizeof p->fw_version); | 166 | strlcpy(p->fw_version, dev->gadget->name, sizeof(p->fw_version)); |
167 | strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof p->bus_info); | 167 | strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof(p->bus_info)); |
168 | } | 168 | } |
169 | 169 | ||
170 | /* REVISIT can also support: | 170 | /* REVISIT can also support: |