diff options
-rw-r--r-- | net/tipc/socket.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index f972c0b4a719..1a2eb23c6223 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1755,20 +1755,16 @@ static int getsockopt(struct socket *sock, release_sock(sk); - if (res) { - /* "get" failed */ - } - else if (len < sizeof(value)) { - res = -EINVAL; - } - else if (copy_to_user(ov, &value, sizeof(value))) { - res = -EFAULT; - } - else { - res = put_user(sizeof(value), ol); - } + if (res) + return res; /* "get" failed */ - return res; + if (len < sizeof(value)) + return -EINVAL; + + if (copy_to_user(ov, &value, sizeof(value))) + return -EFAULT; + + return put_user(sizeof(value), ol); } /** |