Skip to content

Commit

Permalink
lcs: replace sscanf by kstrto function
Browse files Browse the repository at this point in the history
Since a single integer value is read from the supplied buffer
use the kstrto functions instead of sscanf.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Thomas Richter authored and David S. Miller committed Oct 27, 2014
1 parent 3d14f66 commit 786f006
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/s390/net/lcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1943,15 +1943,16 @@ static ssize_t
lcs_portno_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
struct lcs_card *card;
int value, rc;
int rc;
s16 value;

card = dev_get_drvdata(dev);

if (!card)
return 0;

rc = sscanf(buf, "%d", &value);
if (rc != 1)
rc = kstrtos16(buf, 0, &value);
if (rc)
return -EINVAL;
/* TODO: sanity checks */
card->portno = value;
Expand Down Expand Up @@ -2007,8 +2008,8 @@ lcs_timeout_store (struct device *dev, struct device_attribute *attr, const char
if (!card)
return 0;

rc = sscanf(buf, "%u", &value);
if (rc != 1)
rc = kstrtouint(buf, 0, &value);
if (rc)
return -EINVAL;
/* TODO: sanity checks */
card->lancmd_timeout = value;
Expand Down

0 comments on commit 786f006

Please sign in to comment.