Skip to content

Commit

Permalink
atm: clean up a put_user() calls
Browse files Browse the repository at this point in the history
Unlike copy_from_user(), put_user() and get_user() return -EFAULT on
error.  Use the error code directly instead of setting it.

Signed-off-by: Dan Carpenter <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
Dan Carpenter authored and kuba-moo committed Jun 15, 2024
1 parent 6a21fb7 commit afc5625
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/atm/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static int do_vcc_ioctl(struct socket *sock, unsigned int cmd,
goto done;
}
error = put_user(sk->sk_sndbuf - sk_wmem_alloc_get(sk),
(int __user *)argp) ? -EFAULT : 0;
(int __user *)argp);
goto done;
case SIOCINQ:
{
Expand All @@ -83,7 +83,7 @@ static int do_vcc_ioctl(struct socket *sock, unsigned int cmd,
skb = skb_peek(&sk->sk_receive_queue);
amount = skb ? skb->len : 0;
spin_unlock_irq(&sk->sk_receive_queue.lock);
error = put_user(amount, (int __user *)argp) ? -EFAULT : 0;
error = put_user(amount, (int __user *)argp);
goto done;
}
case ATM_SETSC:
Expand Down

0 comments on commit afc5625

Please sign in to comment.