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 /net/dsa | |
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 'net/dsa')
-rw-r--r-- | net/dsa/slave.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index e32083d5d8f8..f795b0ca7ee6 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -203,10 +203,10 @@ dsa_slave_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
203 | static void dsa_slave_get_drvinfo(struct net_device *dev, | 203 | static void dsa_slave_get_drvinfo(struct net_device *dev, |
204 | struct ethtool_drvinfo *drvinfo) | 204 | struct ethtool_drvinfo *drvinfo) |
205 | { | 205 | { |
206 | strncpy(drvinfo->driver, "dsa", 32); | 206 | strlcpy(drvinfo->driver, "dsa", sizeof(drvinfo->driver)); |
207 | strncpy(drvinfo->version, dsa_driver_version, 32); | 207 | strlcpy(drvinfo->version, dsa_driver_version, sizeof(drvinfo->version)); |
208 | strncpy(drvinfo->fw_version, "N/A", 32); | 208 | strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); |
209 | strncpy(drvinfo->bus_info, "platform", 32); | 209 | strlcpy(drvinfo->bus_info, "platform", sizeof(drvinfo->bus_info)); |
210 | } | 210 | } |
211 | 211 | ||
212 | static int dsa_slave_nway_reset(struct net_device *dev) | 212 | static int dsa_slave_nway_reset(struct net_device *dev) |