[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1724E324@AcuExch.aculab.com>
Date: Tue, 27 May 2014 09:34:20 +0000
From: David Laight <David.Laight@...LAB.COM>
To: "'frank.blaschka@...ibm.com'" <frank.blaschka@...ibm.com>,
"davem@...emloft.net" <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>,
Ursula Braun <ursula.braun@...ibm.com>,
Toralf Foerster <toralf.foerster@....de>
Subject: RE: [patch 4/4] s390/net: fix format string mismatches
From: frank.blaschka@...ibm.com
> From: Ursula Braun <ursula.braun@...ibm.com>
>
> cppcheck blamed some issues in drivers/s390/net/...
> They are fixed here.
...
> diff --git a/drivers/s390/net/ctcm_sysfs.c b/drivers/s390/net/ctcm_sysfs.c
> index 985b5dc..883f713 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,
> struct device_attribute *attr, const char *buf, size_t count)
> {
> struct net_device *ndev;
> - int bs1;
> + unsigned int bs1;
> struct ctcm_priv *priv = dev_get_drvdata(dev);
> + int rc;
>
> ndev = priv->channel[CTCM_READ]->netdev;
> if (!(priv && priv->channel[CTCM_READ] && ndev)) {
> @@ -43,7 +44,9 @@ static ssize_t ctcm_buffer_write(struct device *dev,
> return -ENODEV;
> }
>
> - sscanf(buf, "%u", &bs1);
> + rc = sscanf(buf, "%u", &bs1);
There is a spare ' ' here.
I'd have thought that there is a strtoul() function that gives
much clearer error detection than sscanf().
> + if (rc != 1)
> + goto einval;
and something odd with the indentation here.
and some tab/space fubar later on...
David
Powered by blists - more mailing lists