summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 71c9c20)
raw | patch | inline | side by side (parent: 71c9c20)
author | Thomas Meyer <thomas@m3y3r.de> | |
Sat, 13 Aug 2011 08:48:57 +0000 (10:48 +0200) | ||
committer | Greg Kroah-Hartman <gregkh@suse.de> | |
Tue, 23 Aug 2011 22:22:58 +0000 (15:22 -0700) |
Use kmemdup_user rather than duplicating its implementation
This is a little bit restricted to reduce false positives
The semantic patch that makes this output is available
in scripts/coccinelle/api/memdup_user.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This is a little bit restricted to reduce false positives
The semantic patch that makes this output is available
in scripts/coccinelle/api/memdup_user.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/spectra/ffsport.c | patch | blob | history |
index 506547b603e1fb0724e703a943193bfb559b9a8c..86d556d6cf98bb887d75105750f29866be12d5c9 100644 (file)
if (copy_from_user(&info, (void __user *)arg, sizeof(info)))
return -EFAULT;
- buf = kmalloc(IdentifyDeviceData.PageDataSize, GFP_ATOMIC);
- if (!buf) {
- printk(KERN_ERR "ioctl_write_page_data: "
- "failed to allocate memory\n");
- return -ENOMEM;
- }
-
- if (copy_from_user(buf, (void __user *)info.data,
- IdentifyDeviceData.PageDataSize)) {
+ buf = memdup_user((void __user *)info.data,
+ IdentifyDeviceData.PageDataSize);
+ if (IS_ERR(buf)) {
printk(KERN_ERR "ioctl_write_page_data: "
"failed to copy user data\n");
- kfree(buf);
- return -EFAULT;
+ return PTR_ERR(buf);
}
mutex_lock(&spectra_lock);