diff options
Diffstat (limited to 'drivers/ide/ide-taskfile.c')
-rw-r--r-- | drivers/ide/ide-taskfile.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index ace8edad6e96..7ec18fa3b5ff 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -528,9 +528,8 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
528 | 528 | ||
529 | // printk("IDE Taskfile ...\n"); | 529 | // printk("IDE Taskfile ...\n"); |
530 | 530 | ||
531 | req_task = kmalloc(tasksize, GFP_KERNEL); | 531 | req_task = kzalloc(tasksize, GFP_KERNEL); |
532 | if (req_task == NULL) return -ENOMEM; | 532 | if (req_task == NULL) return -ENOMEM; |
533 | memset(req_task, 0, tasksize); | ||
534 | if (copy_from_user(req_task, buf, tasksize)) { | 533 | if (copy_from_user(req_task, buf, tasksize)) { |
535 | kfree(req_task); | 534 | kfree(req_task); |
536 | return -EFAULT; | 535 | return -EFAULT; |
@@ -541,12 +540,11 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
541 | 540 | ||
542 | if (taskout) { | 541 | if (taskout) { |
543 | int outtotal = tasksize; | 542 | int outtotal = tasksize; |
544 | outbuf = kmalloc(taskout, GFP_KERNEL); | 543 | outbuf = kzalloc(taskout, GFP_KERNEL); |
545 | if (outbuf == NULL) { | 544 | if (outbuf == NULL) { |
546 | err = -ENOMEM; | 545 | err = -ENOMEM; |
547 | goto abort; | 546 | goto abort; |
548 | } | 547 | } |
549 | memset(outbuf, 0, taskout); | ||
550 | if (copy_from_user(outbuf, buf + outtotal, taskout)) { | 548 | if (copy_from_user(outbuf, buf + outtotal, taskout)) { |
551 | err = -EFAULT; | 549 | err = -EFAULT; |
552 | goto abort; | 550 | goto abort; |
@@ -555,12 +553,11 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
555 | 553 | ||
556 | if (taskin) { | 554 | if (taskin) { |
557 | int intotal = tasksize + taskout; | 555 | int intotal = tasksize + taskout; |
558 | inbuf = kmalloc(taskin, GFP_KERNEL); | 556 | inbuf = kzalloc(taskin, GFP_KERNEL); |
559 | if (inbuf == NULL) { | 557 | if (inbuf == NULL) { |
560 | err = -ENOMEM; | 558 | err = -ENOMEM; |
561 | goto abort; | 559 | goto abort; |
562 | } | 560 | } |
563 | memset(inbuf, 0, taskin); | ||
564 | if (copy_from_user(inbuf, buf + intotal, taskin)) { | 561 | if (copy_from_user(inbuf, buf + intotal, taskin)) { |
565 | err = -EFAULT; | 562 | err = -EFAULT; |
566 | goto abort; | 563 | goto abort; |
@@ -649,10 +646,8 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
649 | } | 646 | } |
650 | abort: | 647 | abort: |
651 | kfree(req_task); | 648 | kfree(req_task); |
652 | if (outbuf != NULL) | 649 | kfree(outbuf); |
653 | kfree(outbuf); | 650 | kfree(inbuf); |
654 | if (inbuf != NULL) | ||
655 | kfree(inbuf); | ||
656 | 651 | ||
657 | // printk("IDE Taskfile ioctl ended. rc = %i\n", err); | 652 | // printk("IDE Taskfile ioctl ended. rc = %i\n", err); |
658 | 653 | ||
@@ -709,10 +704,9 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
709 | 704 | ||
710 | if (args[3]) { | 705 | if (args[3]) { |
711 | argsize = 4 + (SECTOR_WORDS * 4 * args[3]); | 706 | argsize = 4 + (SECTOR_WORDS * 4 * args[3]); |
712 | argbuf = kmalloc(argsize, GFP_KERNEL); | 707 | argbuf = kzalloc(argsize, GFP_KERNEL); |
713 | if (argbuf == NULL) | 708 | if (argbuf == NULL) |
714 | return -ENOMEM; | 709 | return -ENOMEM; |
715 | memcpy(argbuf, args, 4); | ||
716 | } | 710 | } |
717 | if (set_transfer(drive, &tfargs)) { | 711 | if (set_transfer(drive, &tfargs)) { |
718 | xfer_rate = args[1]; | 712 | xfer_rate = args[1]; |