mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-18 08:56:23 +07:00
btrfs: simplify kmalloc+copy_from_user to memdup_user
Use memdup_user rather than duplicating its implementation This is a little bit restricted to reduce false positives The semantic patch that makes this report is available in scripts/coccinelle/api/memdup_user.cocci. More information about semantic patching is available at http://coccinelle.lip6.fr/ Signed-off-by: Geyslan G. Bem <geyslan@gmail.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
parent
5ede859b00
commit
229eed4348
@ -2715,15 +2715,10 @@ static long btrfs_ioctl_file_extent_same(struct file *file,
|
||||
size = sizeof(tmp) +
|
||||
tmp.dest_count * sizeof(struct btrfs_ioctl_same_extent_info);
|
||||
|
||||
same = kmalloc(size, GFP_NOFS);
|
||||
if (!same) {
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
same = memdup_user((struct btrfs_ioctl_same_args __user *)argp, size);
|
||||
|
||||
if (copy_from_user(same,
|
||||
(struct btrfs_ioctl_same_args __user *)argp, size)) {
|
||||
ret = -EFAULT;
|
||||
if (IS_ERR(same)) {
|
||||
ret = PTR_ERR(same);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user