Commit cd8a383e authored by Andreas Herrmann's avatar Andreas Herrmann Committed by James Bottomley

[SCSI] zfcp: fix module parameter parsing

From: Heiko Carstens <heiko.carstens@de.ibm.com>

Fixes module parameter parsing for "device" parameter.  The original
module parameter was changed while parsing it.  This corrupted the
output in sysfs (/sys/module/zfcp/parameters/device).
Signed-off-by: default avatarAndreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 1db2c9c0
...@@ -218,13 +218,20 @@ zfcp_in_els_dbf_event(struct zfcp_adapter *adapter, const char *text, ...@@ -218,13 +218,20 @@ zfcp_in_els_dbf_event(struct zfcp_adapter *adapter, const char *text,
* Parse "device=..." parameter string. * Parse "device=..." parameter string.
*/ */
static int __init static int __init
zfcp_device_setup(char *str) zfcp_device_setup(char *devstr)
{ {
char *tmp; char *tmp, *str;
size_t len;
if (!str) if (!devstr)
return 0; return 0;
len = strlen(devstr) + 1;
str = (char *) kmalloc(len, GFP_KERNEL);
if (!str)
goto err_out;
memcpy(str, devstr, len);
tmp = strchr(str, ','); tmp = strchr(str, ',');
if (!tmp) if (!tmp)
goto err_out; goto err_out;
...@@ -241,10 +248,12 @@ zfcp_device_setup(char *str) ...@@ -241,10 +248,12 @@ zfcp_device_setup(char *str)
zfcp_data.init_fcp_lun = simple_strtoull(tmp, &tmp, 0); zfcp_data.init_fcp_lun = simple_strtoull(tmp, &tmp, 0);
if (*tmp != '\0') if (*tmp != '\0')
goto err_out; goto err_out;
kfree(str);
return 1; return 1;
err_out: err_out:
ZFCP_LOG_NORMAL("Parse error for device parameter string %s\n", str); ZFCP_LOG_NORMAL("Parse error for device parameter string %s\n", str);
kfree(str);
return 0; return 0;
} }
......
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