Commit d23380701876dd93d310b2548c51d0f78f25d7aa

Authored by Dan Carpenter
Committed by David S. Miller
1 parent 60a5711db6

tehuti: return -EFAULT on copy_to_user errors

copy_to_user() returns the number of bytes remaining but we want to
return a negative error code here.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

drivers/net/tehuti.c
... ... @@ -646,7 +646,7 @@
646 646 error = copy_from_user(data, ifr->ifr_data, sizeof(data));
647 647 if (error) {
648 648 pr_err("cant copy from user\n");
649   - RET(error);
  649 + RET(-EFAULT);
650 650 }
651 651 DBG("%d 0x%x 0x%x\n", data[0], data[1], data[2]);
652 652 }
... ... @@ -665,7 +665,7 @@
665 665 data[2]);
666 666 error = copy_to_user(ifr->ifr_data, data, sizeof(data));
667 667 if (error)
668   - RET(error);
  668 + RET(-EFAULT);
669 669 break;
670 670  
671 671 case BDX_OP_WRITE: