From: Jakub Sitnicki Date: Thu, 4 Oct 2018 09:09:40 +0000 (+0200) Subject: socket: Tighten no-error check in bind() X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=068b88cc175d594393f501a137c7a4af9f356c39;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: David S. Miller --- 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);