xen-scsiback: clean up a type issue in scsiback_make_tpg()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 8 Sep 2014 11:17:35 +0000 (14:17 +0300)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Tue, 23 Sep 2014 13:36:20 +0000 (13:36 +0000)
This code was confusing because we had an unsigned long and then we
compared it to UINT_MAX and then we stored it in a u16.  How many bytes
is this supposed to have: 2, 4 or 16???

I've made it a u16 throughout.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
drivers/xen/xen-scsiback.c

index 7b56563237394a7037a40a344f38d13d1c5b3978..ad11258a78d6b98c715a6b7ece82226fdb4db7e8 100644 (file)
@@ -1885,13 +1885,14 @@ scsiback_make_tpg(struct se_wwn *wwn,
                        struct scsiback_tport, tport_wwn);
 
        struct scsiback_tpg *tpg;
-       unsigned long tpgt;
+       u16 tpgt;
        int ret;
 
        if (strstr(name, "tpgt_") != name)
                return ERR_PTR(-EINVAL);
-       if (kstrtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX)
-               return ERR_PTR(-EINVAL);
+       ret = kstrtou16(name + 5, 10, &tpgt);
+       if (ret)
+               return ERR_PTR(ret);
 
        tpg = kzalloc(sizeof(struct scsiback_tpg), GFP_KERNEL);
        if (!tpg)