Commit 068b88cc authored by Jakub Sitnicki's avatar Jakub Sitnicki Committed by David S. Miller

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: default avatarJakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9a694c1d
...@@ -1475,7 +1475,7 @@ int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen) ...@@ -1475,7 +1475,7 @@ int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen)
sock = sockfd_lookup_light(fd, &err, &fput_needed); sock = sockfd_lookup_light(fd, &err, &fput_needed);
if (sock) { if (sock) {
err = move_addr_to_kernel(umyaddr, addrlen, &address); err = move_addr_to_kernel(umyaddr, addrlen, &address);
if (err >= 0) { if (!err) {
err = security_socket_bind(sock, err = security_socket_bind(sock,
(struct sockaddr *)&address, (struct sockaddr *)&address,
addrlen); addrlen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment