diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/pcmcia/cm4040_cs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 0e82968c2f38..f2e4ec4fd407 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -273,6 +273,7 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf, | |||
273 | DEBUGP(6, dev, "BytesToRead=%lu\n", bytes_to_read); | 273 | DEBUGP(6, dev, "BytesToRead=%lu\n", bytes_to_read); |
274 | 274 | ||
275 | min_bytes_to_read = min(count, bytes_to_read + 5); | 275 | min_bytes_to_read = min(count, bytes_to_read + 5); |
276 | min_bytes_to_read = min_t(size_t, min_bytes_to_read, READ_WRITE_BUFFER_SIZE); | ||
276 | 277 | ||
277 | DEBUGP(6, dev, "Min=%lu\n", min_bytes_to_read); | 278 | DEBUGP(6, dev, "Min=%lu\n", min_bytes_to_read); |
278 | 279 | ||
@@ -340,7 +341,7 @@ static ssize_t cm4040_write(struct file *filp, const char __user *buf, | |||
340 | return 0; | 341 | return 0; |
341 | } | 342 | } |
342 | 343 | ||
343 | if (count < 5) { | 344 | if ((count < 5) || (count > READ_WRITE_BUFFER_SIZE)) { |
344 | DEBUGP(2, dev, "<- cm4040_write buffersize=%Zd < 5\n", count); | 345 | DEBUGP(2, dev, "<- cm4040_write buffersize=%Zd < 5\n", count); |
345 | return -EIO; | 346 | return -EIO; |
346 | } | 347 | } |