summaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_cfdc.c
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2010-07-16 15:37:34 +0200
committerJames Bottomley <James.Bottomley@suse.de>2010-07-28 16:48:45 +0200
commit674c3a993c278b7469e1cf12bfc13e6838dfd877 (patch)
tree4b52c44b3f9f9dc8f3a0456cf5a391564196dd5d /drivers/s390/scsi/zfcp_cfdc.c
parent[SCSI] zfcp: Fix retry after failed "open port" erp action (diff)
downloadlinux-674c3a993c278b7469e1cf12bfc13e6838dfd877.tar.xz
linux-674c3a993c278b7469e1cf12bfc13e6838dfd877.zip
[SCSI] zfcp: Use memdup_user and kstrdup
Use the functions memdup_user and kstrdup to allocate memory and copy the data in one step, saving some lines of code. Reviewed-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi/zfcp_cfdc.c')
-rw-r--r--drivers/s390/scsi/zfcp_cfdc.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/s390/scsi/zfcp_cfdc.c b/drivers/s390/scsi/zfcp_cfdc.c
index 1a2db0a35737..fcbd2b756da4 100644
--- a/drivers/s390/scsi/zfcp_cfdc.c
+++ b/drivers/s390/scsi/zfcp_cfdc.c
@@ -189,18 +189,12 @@ static long zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command,
if (!fsf_cfdc)
return -ENOMEM;
- data = kmalloc(sizeof(struct zfcp_cfdc_data), GFP_KERNEL);
- if (!data) {
- retval = -ENOMEM;
+ data = memdup_user(data_user, sizeof(*data_user));
+ if (IS_ERR(data)) {
+ retval = PTR_ERR(data);
goto no_mem_sense;
}
- retval = copy_from_user(data, data_user, sizeof(*data));
- if (retval) {
- retval = -EFAULT;
- goto free_buffer;
- }
-
if (data->signature != 0xCFDCACDF) {
retval = -EINVAL;
goto free_buffer;