diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2008-04-30 13:38:33 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2008-04-30 13:38:43 +0200 |
commit | 2f972202315cf71fd60e890ebbed7d5bcf620ba4 (patch) | |
tree | 80e43d5bacb7b85417168bc257369d3642cc196c /drivers/s390/cio/cmf.c | |
parent | 0ff5ce7f30b45cc2014cec465c0e96c16877116e (diff) |
[S390] cio: Use strict_strtoul() for attributes.
Make parsing of attribute writes handle incorrect input better.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio/cmf.c')
-rw-r--r-- | drivers/s390/cio/cmf.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c index f4c132ab39ed..2808b6833b9e 100644 --- a/drivers/s390/cio/cmf.c +++ b/drivers/s390/cio/cmf.c @@ -1219,16 +1219,21 @@ static ssize_t cmb_enable_store(struct device *dev, { struct ccw_device *cdev; int ret; + unsigned long val; + + ret = strict_strtoul(buf, 16, &val); + if (ret) + return ret; cdev = to_ccwdev(dev); - switch (buf[0]) { - case '0': + switch (val) { + case 0: ret = disable_cmf(cdev); if (ret) dev_info(&cdev->dev, "disable_cmf failed (%d)\n", ret); break; - case '1': + case 1: ret = enable_cmf(cdev); if (ret && ret != -EBUSY) dev_info(&cdev->dev, "enable_cmf failed (%d)\n", ret); |