diff options
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index b258444511a7..de70cb7789f2 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -1587,7 +1587,7 @@ abort: | |||
1587 | } | 1587 | } |
1588 | 1588 | ||
1589 | static int idetape_copy_stage_from_user(idetape_tape_t *tape, | 1589 | static int idetape_copy_stage_from_user(idetape_tape_t *tape, |
1590 | idetape_stage_t *stage, const char __user *buf, int n) | 1590 | const char __user *buf, int n) |
1591 | { | 1591 | { |
1592 | struct idetape_bh *bh = tape->bh; | 1592 | struct idetape_bh *bh = tape->bh; |
1593 | int count; | 1593 | int count; |
@@ -2588,8 +2588,7 @@ static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf, | |||
2588 | actually_written = min((unsigned int) | 2588 | actually_written = min((unsigned int) |
2589 | (tape->stage_size - tape->merge_stage_size), | 2589 | (tape->stage_size - tape->merge_stage_size), |
2590 | (unsigned int)count); | 2590 | (unsigned int)count); |
2591 | if (idetape_copy_stage_from_user(tape, tape->merge_stage, buf, | 2591 | if (idetape_copy_stage_from_user(tape, buf, actually_written)) |
2592 | actually_written)) | ||
2593 | ret = -EFAULT; | 2592 | ret = -EFAULT; |
2594 | buf += actually_written; | 2593 | buf += actually_written; |
2595 | tape->merge_stage_size += actually_written; | 2594 | tape->merge_stage_size += actually_written; |
@@ -2605,8 +2604,7 @@ static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf, | |||
2605 | } | 2604 | } |
2606 | while (count >= tape->stage_size) { | 2605 | while (count >= tape->stage_size) { |
2607 | ssize_t retval; | 2606 | ssize_t retval; |
2608 | if (idetape_copy_stage_from_user(tape, tape->merge_stage, buf, | 2607 | if (idetape_copy_stage_from_user(tape, buf, tape->stage_size)) |
2609 | tape->stage_size)) | ||
2610 | ret = -EFAULT; | 2608 | ret = -EFAULT; |
2611 | buf += tape->stage_size; | 2609 | buf += tape->stage_size; |
2612 | count -= tape->stage_size; | 2610 | count -= tape->stage_size; |
@@ -2617,8 +2615,7 @@ static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf, | |||
2617 | } | 2615 | } |
2618 | if (count) { | 2616 | if (count) { |
2619 | actually_written += count; | 2617 | actually_written += count; |
2620 | if (idetape_copy_stage_from_user(tape, tape->merge_stage, buf, | 2618 | if (idetape_copy_stage_from_user(tape, buf, count)) |
2621 | count)) | ||
2622 | ret = -EFAULT; | 2619 | ret = -EFAULT; |
2623 | tape->merge_stage_size += count; | 2620 | tape->merge_stage_size += count; |
2624 | } | 2621 | } |