Commit a68be015 authored by Ursula Braun's avatar Ursula Braun Committed by David S. Miller

s390/net: fix format string mismatches

cppcheck blamed some issues in drivers/s390/net/...
They are fixed here.
Signed-off-by: default avatarUrsula Braun <ursula.braun@de.ibm.com>
Signed-off-by: default avatarFrank Blaschka <blaschka@linux.vnet.ibm.com>
Reported-by: default avatarToralf Foerster <toralf.foerster@gmx.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e95051ff
...@@ -34,8 +34,9 @@ static ssize_t ctcm_buffer_write(struct device *dev, ...@@ -34,8 +34,9 @@ static ssize_t ctcm_buffer_write(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
struct net_device *ndev; struct net_device *ndev;
int bs1; unsigned int bs1;
struct ctcm_priv *priv = dev_get_drvdata(dev); struct ctcm_priv *priv = dev_get_drvdata(dev);
int rc;
ndev = priv->channel[CTCM_READ]->netdev; ndev = priv->channel[CTCM_READ]->netdev;
if (!(priv && priv->channel[CTCM_READ] && ndev)) { if (!(priv && priv->channel[CTCM_READ] && ndev)) {
...@@ -43,7 +44,9 @@ static ssize_t ctcm_buffer_write(struct device *dev, ...@@ -43,7 +44,9 @@ static ssize_t ctcm_buffer_write(struct device *dev,
return -ENODEV; return -ENODEV;
} }
sscanf(buf, "%u", &bs1); rc = sscanf(buf, "%u", &bs1);
if (rc != 1)
goto einval;
if (bs1 > CTCM_BUFSIZE_LIMIT) if (bs1 > CTCM_BUFSIZE_LIMIT)
goto einval; goto einval;
if (bs1 < (576 + LL_HEADER_LENGTH + 2)) if (bs1 < (576 + LL_HEADER_LENGTH + 2))
...@@ -143,13 +146,14 @@ static ssize_t ctcm_proto_show(struct device *dev, ...@@ -143,13 +146,14 @@ static ssize_t ctcm_proto_show(struct device *dev,
static ssize_t ctcm_proto_store(struct device *dev, static ssize_t ctcm_proto_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
int value; int value, rc;
struct ctcm_priv *priv = dev_get_drvdata(dev); struct ctcm_priv *priv = dev_get_drvdata(dev);
if (!priv) if (!priv)
return -ENODEV; return -ENODEV;
sscanf(buf, "%u", &value); rc = sscanf(buf, "%d", &value);
if (!((value == CTCM_PROTO_S390) || if ((rc != 1) ||
!((value == CTCM_PROTO_S390) ||
(value == CTCM_PROTO_LINUX) || (value == CTCM_PROTO_LINUX) ||
(value == CTCM_PROTO_MPC) || (value == CTCM_PROTO_MPC) ||
(value == CTCM_PROTO_OS390))) (value == CTCM_PROTO_OS390)))
......
...@@ -1943,14 +1943,16 @@ static ssize_t ...@@ -1943,14 +1943,16 @@ static ssize_t
lcs_portno_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) lcs_portno_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
struct lcs_card *card; struct lcs_card *card;
int value; int value, rc;
card = dev_get_drvdata(dev); card = dev_get_drvdata(dev);
if (!card) if (!card)
return 0; return 0;
sscanf(buf, "%u", &value); rc = sscanf(buf, "%d", &value);
if (rc != 1)
return -EINVAL;
/* TODO: sanity checks */ /* TODO: sanity checks */
card->portno = value; card->portno = value;
...@@ -1997,14 +1999,17 @@ static ssize_t ...@@ -1997,14 +1999,17 @@ static ssize_t
lcs_timeout_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) lcs_timeout_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
struct lcs_card *card; struct lcs_card *card;
int value; unsigned int value;
int rc;
card = dev_get_drvdata(dev); card = dev_get_drvdata(dev);
if (!card) if (!card)
return 0; return 0;
sscanf(buf, "%u", &value); rc = sscanf(buf, "%u", &value);
if (rc != 1)
return -EINVAL;
/* TODO: sanity checks */ /* TODO: sanity checks */
card->lancmd_timeout = value; card->lancmd_timeout = value;
......
...@@ -63,7 +63,7 @@ void qeth_l3_ipaddr4_to_string(const __u8 *addr, char *buf) ...@@ -63,7 +63,7 @@ void qeth_l3_ipaddr4_to_string(const __u8 *addr, char *buf)
int qeth_l3_string_to_ipaddr4(const char *buf, __u8 *addr) int qeth_l3_string_to_ipaddr4(const char *buf, __u8 *addr)
{ {
int count = 0, rc = 0; int count = 0, rc = 0;
int in[4]; unsigned int in[4];
char c; char c;
rc = sscanf(buf, "%u.%u.%u.%u%c", rc = sscanf(buf, "%u.%u.%u.%u%c",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment