Skip to content

Commit

Permalink
cdrom: don't open-code memdup_user()
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jan 6, 2016
1 parent 820351f commit abb0f6a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions drivers/cdrom/cdrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -3186,15 +3186,11 @@ static noinline int mmc_ioctl_dvd_read_struct(struct cdrom_device_info *cdi,
if (!CDROM_CAN(CDC_DVD))
return -ENOSYS;

s = kmalloc(size, GFP_KERNEL);
if (!s)
return -ENOMEM;
s = memdup_user(arg, size);
if (IS_ERR(s))
return PTR_ERR(s);

cd_dbg(CD_DO_IOCTL, "entering DVD_READ_STRUCT\n");
if (copy_from_user(s, arg, size)) {
kfree(s);
return -EFAULT;
}

ret = dvd_read_struct(cdi, s, cgc);
if (ret)
Expand Down

0 comments on commit abb0f6a

Please sign in to comment.