diff options
author | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-31 00:57:05 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-31 00:57:05 -0400 |
commit | 5bc65793cbf8da0d35f19ef025dda22887e79e80 (patch) | |
tree | 8291998abd73055de6f487fafa174ee2a5d3afee /drivers/spi/spidev.c | |
parent | 6edae708bf77e012d855a7e2c7766f211d234f4f (diff) | |
parent | 3f0a6766e0cc5a577805732e5adb50a585c58175 (diff) |
[SCSI] Merge up to linux-2.6 head
Conflicts:
drivers/scsi/jazz_esp.c
Same changes made by both SCSI and SPARC trees: problem with UTF-8
conversion in the copyright.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/spi/spidev.c')
-rw-r--r-- | drivers/spi/spidev.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index c0a6dce800a3..d04242aee40d 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c | |||
@@ -168,6 +168,12 @@ static int spidev_message(struct spidev_data *spidev, | |||
168 | n--, k_tmp++, u_tmp++) { | 168 | n--, k_tmp++, u_tmp++) { |
169 | k_tmp->len = u_tmp->len; | 169 | k_tmp->len = u_tmp->len; |
170 | 170 | ||
171 | total += k_tmp->len; | ||
172 | if (total > bufsiz) { | ||
173 | status = -EMSGSIZE; | ||
174 | goto done; | ||
175 | } | ||
176 | |||
171 | if (u_tmp->rx_buf) { | 177 | if (u_tmp->rx_buf) { |
172 | k_tmp->rx_buf = buf; | 178 | k_tmp->rx_buf = buf; |
173 | if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len)) | 179 | if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len)) |
@@ -179,12 +185,6 @@ static int spidev_message(struct spidev_data *spidev, | |||
179 | u_tmp->len)) | 185 | u_tmp->len)) |
180 | goto done; | 186 | goto done; |
181 | } | 187 | } |
182 | |||
183 | total += k_tmp->len; | ||
184 | if (total > bufsiz) { | ||
185 | status = -EMSGSIZE; | ||
186 | goto done; | ||
187 | } | ||
188 | buf += k_tmp->len; | 188 | buf += k_tmp->len; |
189 | 189 | ||
190 | k_tmp->cs_change = !!u_tmp->cs_change; | 190 | k_tmp->cs_change = !!u_tmp->cs_change; |
@@ -364,6 +364,7 @@ spidev_ioctl(struct inode *inode, struct file *filp, | |||
364 | break; | 364 | break; |
365 | } | 365 | } |
366 | if (__copy_from_user(ioc, (void __user *)arg, tmp)) { | 366 | if (__copy_from_user(ioc, (void __user *)arg, tmp)) { |
367 | kfree(ioc); | ||
367 | retval = -EFAULT; | 368 | retval = -EFAULT; |
368 | break; | 369 | break; |
369 | } | 370 | } |
@@ -484,7 +485,7 @@ static int spidev_probe(struct spi_device *spi) | |||
484 | * Reusing minors is fine so long as udev or mdev is working. | 485 | * Reusing minors is fine so long as udev or mdev is working. |
485 | */ | 486 | */ |
486 | mutex_lock(&device_list_lock); | 487 | mutex_lock(&device_list_lock); |
487 | minor = find_first_zero_bit(minors, ARRAY_SIZE(minors)); | 488 | minor = find_first_zero_bit(minors, N_SPI_MINORS); |
488 | if (minor < N_SPI_MINORS) { | 489 | if (minor < N_SPI_MINORS) { |
489 | spidev->dev.parent = &spi->dev; | 490 | spidev->dev.parent = &spi->dev; |
490 | spidev->dev.class = &spidev_class; | 491 | spidev->dev.class = &spidev_class; |