diff options
-rw-r--r-- | drivers/cdrom/cdrom.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 55eaf474d32c..8fefe59f52a7 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -2119,11 +2119,6 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2119 | if (!nr) | 2119 | if (!nr) |
2120 | return -ENOMEM; | 2120 | return -ENOMEM; |
2121 | 2121 | ||
2122 | if (!access_ok(VERIFY_WRITE, ubuf, nframes * CD_FRAMESIZE_RAW)) { | ||
2123 | ret = -EFAULT; | ||
2124 | goto out; | ||
2125 | } | ||
2126 | |||
2127 | cgc.data_direction = CGC_DATA_READ; | 2122 | cgc.data_direction = CGC_DATA_READ; |
2128 | while (nframes > 0) { | 2123 | while (nframes > 0) { |
2129 | if (nr > nframes) | 2124 | if (nr > nframes) |
@@ -2132,7 +2127,7 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2132 | ret = cdrom_read_block(cdi, &cgc, lba, nr, 1, CD_FRAMESIZE_RAW); | 2127 | ret = cdrom_read_block(cdi, &cgc, lba, nr, 1, CD_FRAMESIZE_RAW); |
2133 | if (ret) | 2128 | if (ret) |
2134 | break; | 2129 | break; |
2135 | if (__copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr)) { | 2130 | if (copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr)) { |
2136 | ret = -EFAULT; | 2131 | ret = -EFAULT; |
2137 | break; | 2132 | break; |
2138 | } | 2133 | } |
@@ -2140,7 +2135,6 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2140 | nframes -= nr; | 2135 | nframes -= nr; |
2141 | lba += nr; | 2136 | lba += nr; |
2142 | } | 2137 | } |
2143 | out: | ||
2144 | kfree(cgc.buffer); | 2138 | kfree(cgc.buffer); |
2145 | return ret; | 2139 | return ret; |
2146 | } | 2140 | } |