Commit abb0f6a7 authored by Al Viro's avatar Al Viro

cdrom: don't open-code memdup_user()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 820351f0
...@@ -3186,15 +3186,11 @@ static noinline int mmc_ioctl_dvd_read_struct(struct cdrom_device_info *cdi, ...@@ -3186,15 +3186,11 @@ static noinline int mmc_ioctl_dvd_read_struct(struct cdrom_device_info *cdi,
if (!CDROM_CAN(CDC_DVD)) if (!CDROM_CAN(CDC_DVD))
return -ENOSYS; return -ENOSYS;
s = kmalloc(size, GFP_KERNEL); s = memdup_user(arg, size);
if (!s) if (IS_ERR(s))
return -ENOMEM; return PTR_ERR(s);
cd_dbg(CD_DO_IOCTL, "entering DVD_READ_STRUCT\n"); 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); ret = dvd_read_struct(cdi, s, cgc);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment