aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorUrsula Braun <ursula.braun@de.ibm.com>2014-05-28 04:22:31 -0400
committerDavid S. Miller <davem@davemloft.net>2014-05-30 20:35:23 -0400
commita68be015aece7b9f33f1523048e445b72ca7111d (patch)
treeaf8d8ad62a6b81cc570cdfed83496872e670e909 /drivers/s390
parente95051ff5a0b76e672f6d30e8bb8f93cc11c8018 (diff)
s390/net: fix format string mismatches
cppcheck blamed some issues in drivers/s390/net/... They are fixed here. Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com> Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com> Reported-by: Toralf Foerster <toralf.foerster@gmx.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/net/ctcm_sysfs.c14
-rw-r--r--drivers/s390/net/lcs.c13
-rw-r--r--drivers/s390/net/qeth_l3_main.c2
3 files changed, 19 insertions, 10 deletions
diff --git a/drivers/s390/net/ctcm_sysfs.c b/drivers/s390/net/ctcm_sysfs.c
index 985b5dcbdac8..6bcfbbb20f04 100644
--- a/drivers/s390/net/ctcm_sysfs.c
+++ b/drivers/s390/net/ctcm_sysfs.c
@@ -34,8 +34,9 @@ static ssize_t ctcm_buffer_write(struct device *dev,
34 struct device_attribute *attr, const char *buf, size_t count) 34 struct device_attribute *attr, const char *buf, size_t count)
35{ 35{
36 struct net_device *ndev; 36 struct net_device *ndev;
37 int bs1; 37 unsigned int bs1;
38 struct ctcm_priv *priv = dev_get_drvdata(dev); 38 struct ctcm_priv *priv = dev_get_drvdata(dev);
39 int rc;
39 40
40 ndev = priv->channel[CTCM_READ]->netdev; 41 ndev = priv->channel[CTCM_READ]->netdev;
41 if (!(priv && priv->channel[CTCM_READ] && ndev)) { 42 if (!(priv && priv->channel[CTCM_READ] && ndev)) {
@@ -43,7 +44,9 @@ static ssize_t ctcm_buffer_write(struct device *dev,
43 return -ENODEV; 44 return -ENODEV;
44 } 45 }
45 46
46 sscanf(buf, "%u", &bs1); 47 rc = sscanf(buf, "%u", &bs1);
48 if (rc != 1)
49 goto einval;
47 if (bs1 > CTCM_BUFSIZE_LIMIT) 50 if (bs1 > CTCM_BUFSIZE_LIMIT)
48 goto einval; 51 goto einval;
49 if (bs1 < (576 + LL_HEADER_LENGTH + 2)) 52 if (bs1 < (576 + LL_HEADER_LENGTH + 2))
@@ -143,13 +146,14 @@ static ssize_t ctcm_proto_show(struct device *dev,
143static ssize_t ctcm_proto_store(struct device *dev, 146static ssize_t ctcm_proto_store(struct device *dev,
144 struct device_attribute *attr, const char *buf, size_t count) 147 struct device_attribute *attr, const char *buf, size_t count)
145{ 148{
146 int value; 149 int value, rc;
147 struct ctcm_priv *priv = dev_get_drvdata(dev); 150 struct ctcm_priv *priv = dev_get_drvdata(dev);
148 151
149 if (!priv) 152 if (!priv)
150 return -ENODEV; 153 return -ENODEV;
151 sscanf(buf, "%u", &value); 154 rc = sscanf(buf, "%d", &value);
152 if (!((value == CTCM_PROTO_S390) || 155 if ((rc != 1) ||
156 !((value == CTCM_PROTO_S390) ||
153 (value == CTCM_PROTO_LINUX) || 157 (value == CTCM_PROTO_LINUX) ||
154 (value == CTCM_PROTO_MPC) || 158 (value == CTCM_PROTO_MPC) ||
155 (value == CTCM_PROTO_OS390))) 159 (value == CTCM_PROTO_OS390)))
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 8d5d96969c39..0a7d87c372b8 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -1943,14 +1943,16 @@ static ssize_t
1943lcs_portno_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 1943lcs_portno_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1944{ 1944{
1945 struct lcs_card *card; 1945 struct lcs_card *card;
1946 int value; 1946 int value, rc;
1947 1947
1948 card = dev_get_drvdata(dev); 1948 card = dev_get_drvdata(dev);
1949 1949
1950 if (!card) 1950 if (!card)
1951 return 0; 1951 return 0;
1952 1952
1953 sscanf(buf, "%u", &value); 1953 rc = sscanf(buf, "%d", &value);
1954 if (rc != 1)
1955 return -EINVAL;
1954 /* TODO: sanity checks */ 1956 /* TODO: sanity checks */
1955 card->portno = value; 1957 card->portno = value;
1956 1958
@@ -1997,14 +1999,17 @@ static ssize_t
1997lcs_timeout_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 1999lcs_timeout_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1998{ 2000{
1999 struct lcs_card *card; 2001 struct lcs_card *card;
2000 int value; 2002 unsigned int value;
2003 int rc;
2001 2004
2002 card = dev_get_drvdata(dev); 2005 card = dev_get_drvdata(dev);
2003 2006
2004 if (!card) 2007 if (!card)
2005 return 0; 2008 return 0;
2006 2009
2007 sscanf(buf, "%u", &value); 2010 rc = sscanf(buf, "%u", &value);
2011 if (rc != 1)
2012 return -EINVAL;
2008 /* TODO: sanity checks */ 2013 /* TODO: sanity checks */
2009 card->lancmd_timeout = value; 2014 card->lancmd_timeout = value;
2010 2015
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index c58f82af3658..14e0b5810e8c 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -63,7 +63,7 @@ void qeth_l3_ipaddr4_to_string(const __u8 *addr, char *buf)
63int qeth_l3_string_to_ipaddr4(const char *buf, __u8 *addr) 63int qeth_l3_string_to_ipaddr4(const char *buf, __u8 *addr)
64{ 64{
65 int count = 0, rc = 0; 65 int count = 0, rc = 0;
66 int in[4]; 66 unsigned int in[4];
67 char c; 67 char c;
68 68
69 rc = sscanf(buf, "%u.%u.%u.%u%c", 69 rc = sscanf(buf, "%u.%u.%u.%u%c",