Commit 495daef9 authored by Dan Carpenter's avatar Dan Carpenter Committed by Stefano Stabellini

xen-scsiback: clean up a type issue in scsiback_make_tpg()

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
parent d9b1e637
...@@ -1885,13 +1885,14 @@ scsiback_make_tpg(struct se_wwn *wwn, ...@@ -1885,13 +1885,14 @@ scsiback_make_tpg(struct se_wwn *wwn,
struct scsiback_tport, tport_wwn); struct scsiback_tport, tport_wwn);
struct scsiback_tpg *tpg; struct scsiback_tpg *tpg;
unsigned long tpgt; u16 tpgt;
int ret; int ret;
if (strstr(name, "tpgt_") != name) if (strstr(name, "tpgt_") != name)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
if (kstrtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX) ret = kstrtou16(name + 5, 10, &tpgt);
return ERR_PTR(-EINVAL); if (ret)
return ERR_PTR(ret);
tpg = kzalloc(sizeof(struct scsiback_tpg), GFP_KERNEL); tpg = kzalloc(sizeof(struct scsiback_tpg), GFP_KERNEL);
if (!tpg) if (!tpg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment