]> git.karo-electronics.de Git - linux-beck.git/commitdiff
RDMA/nes: Add a check for strict_strtoul()
authorLiu Yuan <tailai.ly@taobao.com>
Fri, 1 Apr 2011 06:23:49 +0000 (06:23 +0000)
committerRoland Dreier <roland@purestorage.com>
Tue, 24 May 2011 17:06:25 +0000 (10:06 -0700)
It should check if strict_strtoul() succeeds before using
'wqm_quanta_value'.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
[ Convert to kstrtoul() directly while we're here.  - Roland ]

Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/nes/nes.c

index 13de1192927cc50da063562fdc8a47e8a4336422..2d668c69f6d958bcd9ba275967c8bbc1f3a93b9d 100644 (file)
@@ -1138,7 +1138,9 @@ static ssize_t nes_store_wqm_quanta(struct device_driver *ddp,
        u32 i = 0;
        struct nes_device *nesdev;
 
-       strict_strtoul(buf, 0, &wqm_quanta_value);
+       if (kstrtoul(buf, 0, &wqm_quanta_value) < 0)
+               return -EINVAL;
+
        list_for_each_entry(nesdev, &nes_dev_list, list) {
                if (i == ee_flsh_adapter) {
                        nesdev->nesadapter->wqm_quanta = wqm_quanta_value;