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/s390/net | |
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/s390/net')
-rw-r--r-- | drivers/s390/net/qeth_core_main.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 638a57f4d8a1..029a7acf7b7a 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -5444,17 +5444,14 @@ void qeth_core_get_drvinfo(struct net_device *dev, | |||
5444 | struct ethtool_drvinfo *info) | 5444 | struct ethtool_drvinfo *info) |
5445 | { | 5445 | { |
5446 | struct qeth_card *card = dev->ml_priv; | 5446 | struct qeth_card *card = dev->ml_priv; |
5447 | if (card->options.layer2) | 5447 | |
5448 | strcpy(info->driver, "qeth_l2"); | 5448 | strlcpy(info->driver, card->options.layer2 ? "qeth_l2" : "qeth_l3", |
5449 | else | 5449 | sizeof(info->driver)); |
5450 | strcpy(info->driver, "qeth_l3"); | 5450 | strlcpy(info->version, "1.0", sizeof(info->version)); |
5451 | 5451 | strlcpy(info->fw_version, card->info.mcl_level, | |
5452 | strcpy(info->version, "1.0"); | 5452 | sizeof(info->fw_version)); |
5453 | strcpy(info->fw_version, card->info.mcl_level); | 5453 | snprintf(info->bus_info, sizeof(info->bus_info), "%s/%s/%s", |
5454 | sprintf(info->bus_info, "%s/%s/%s", | 5454 | CARD_RDEV_ID(card), CARD_WDEV_ID(card), CARD_DDEV_ID(card)); |
5455 | CARD_RDEV_ID(card), | ||
5456 | CARD_WDEV_ID(card), | ||
5457 | CARD_DDEV_ID(card)); | ||
5458 | } | 5455 | } |
5459 | EXPORT_SYMBOL_GPL(qeth_core_get_drvinfo); | 5456 | EXPORT_SYMBOL_GPL(qeth_core_get_drvinfo); |
5460 | 5457 | ||