Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by

Andreas Herrmann and committed by
James Bottomley
cd8a383e 1db2c9c0

+12 -3
+12 -3
drivers/s390/scsi/zfcp_aux.c
··· 218 218 * Parse "device=..." parameter string. 219 219 */ 220 220 static int __init 221 - zfcp_device_setup(char *str) 221 + zfcp_device_setup(char *devstr) 222 222 { 223 - char *tmp; 223 + char *tmp, *str; 224 + size_t len; 224 225 225 - if (!str) 226 + if (!devstr) 226 227 return 0; 228 + 229 + len = strlen(devstr) + 1; 230 + str = (char *) kmalloc(len, GFP_KERNEL); 231 + if (!str) 232 + goto err_out; 233 + memcpy(str, devstr, len); 227 234 228 235 tmp = strchr(str, ','); 229 236 if (!tmp) ··· 248 241 zfcp_data.init_fcp_lun = simple_strtoull(tmp, &tmp, 0); 249 242 if (*tmp != '\0') 250 243 goto err_out; 244 + kfree(str); 251 245 return 1; 252 246 253 247 err_out: 254 248 ZFCP_LOG_NORMAL("Parse error for device parameter string %s\n", str); 249 + kfree(str); 255 250 return 0; 256 251 } 257 252