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 <>
Signed-off-by: default avatarDavid S. Miller <>
parent 9a694c1d
......@@ -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,
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment