aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-tape.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r--drivers/ide/ide-tape.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index e176b5c1b208..b258444511a7 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -1619,7 +1619,7 @@ static int idetape_copy_stage_from_user(idetape_tape_t *tape,
1619} 1619}
1620 1620
1621static int idetape_copy_stage_to_user(idetape_tape_t *tape, char __user *buf, 1621static int idetape_copy_stage_to_user(idetape_tape_t *tape, char __user *buf,
1622 idetape_stage_t *stage, int n) 1622 int n)
1623{ 1623{
1624 struct idetape_bh *bh = tape->bh; 1624 struct idetape_bh *bh = tape->bh;
1625 int count; 1625 int count;
@@ -2493,8 +2493,7 @@ static ssize_t idetape_chrdev_read(struct file *file, char __user *buf,
2493 if (tape->merge_stage_size) { 2493 if (tape->merge_stage_size) {
2494 actually_read = min((unsigned int)(tape->merge_stage_size), 2494 actually_read = min((unsigned int)(tape->merge_stage_size),
2495 (unsigned int)count); 2495 (unsigned int)count);
2496 if (idetape_copy_stage_to_user(tape, buf, tape->merge_stage, 2496 if (idetape_copy_stage_to_user(tape, buf, actually_read))
2497 actually_read))
2498 ret = -EFAULT; 2497 ret = -EFAULT;
2499 buf += actually_read; 2498 buf += actually_read;
2500 tape->merge_stage_size -= actually_read; 2499 tape->merge_stage_size -= actually_read;
@@ -2504,8 +2503,7 @@ static ssize_t idetape_chrdev_read(struct file *file, char __user *buf,
2504 bytes_read = idetape_add_chrdev_read_request(drive, ctl); 2503 bytes_read = idetape_add_chrdev_read_request(drive, ctl);
2505 if (bytes_read <= 0) 2504 if (bytes_read <= 0)
2506 goto finish; 2505 goto finish;
2507 if (idetape_copy_stage_to_user(tape, buf, tape->merge_stage, 2506 if (idetape_copy_stage_to_user(tape, buf, bytes_read))
2508 bytes_read))
2509 ret = -EFAULT; 2507 ret = -EFAULT;
2510 buf += bytes_read; 2508 buf += bytes_read;
2511 count -= bytes_read; 2509 count -= bytes_read;
@@ -2516,8 +2514,7 @@ static ssize_t idetape_chrdev_read(struct file *file, char __user *buf,
2516 if (bytes_read <= 0) 2514 if (bytes_read <= 0)
2517 goto finish; 2515 goto finish;
2518 temp = min((unsigned long)count, (unsigned long)bytes_read); 2516 temp = min((unsigned long)count, (unsigned long)bytes_read);
2519 if (idetape_copy_stage_to_user(tape, buf, tape->merge_stage, 2517 if (idetape_copy_stage_to_user(tape, buf, temp))
2520 temp))
2521 ret = -EFAULT; 2518 ret = -EFAULT;
2522 actually_read += temp; 2519 actually_read += temp;
2523 tape->merge_stage_size = bytes_read-temp; 2520 tape->merge_stage_size = bytes_read-temp;