summaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorJakub Sitnicki <jakub@cloudflare.com>2018-10-04 11:09:40 +0200
committerDavid S. Miller <davem@davemloft.net>2018-10-05 14:34:45 -0700
commit068b88cc175d594393f501a137c7a4af9f356c39 (patch)
treec1eb50ea94e8064bca08243b34d5eb319daa0c12 /net/socket.c
parent9a694c1de396e24565bfd05d0e36f72d10c3bce2 (diff)
downloadlinux-068b88cc175d594393f501a137c7a4af9f356c39.tar.bz2
socket: Tighten no-error check in bind()
move_addr_to_kernel() returns only negative values on error, or zero on success. Rewrite the error check to an idiomatic form to avoid confusing the reader. Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/socket.c b/net/socket.c
index 01f3f8f32d6f..713dc4833d40 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1475,7 +1475,7 @@ int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen)
sock = sockfd_lookup_light(fd, &err, &fput_needed);
if (sock) {
err = move_addr_to_kernel(umyaddr, addrlen, &address);
- if (err >= 0) {
+ if (!err) {
err = security_socket_bind(sock,
(struct sockaddr *)&address,
addrlen);