* [PATCH net-next] socket: Tighten no-error check in bind()
@ 2018-10-04 9:09 Jakub Sitnicki
2018-10-05 21:35 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Sitnicki @ 2018-10-04 9:09 UTC (permalink / raw)
To: netdev
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>
---
net/socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] socket: Tighten no-error check in bind()
2018-10-04 9:09 [PATCH net-next] socket: Tighten no-error check in bind() Jakub Sitnicki
@ 2018-10-05 21:35 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-10-05 21:35 UTC (permalink / raw)
To: jakub; +Cc: netdev
From: Jakub Sitnicki <jakub@cloudflare.com>
Date: Thu, 4 Oct 2018 11:09:40 +0200
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-06 4:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-04 9:09 [PATCH net-next] socket: Tighten no-error check in bind() Jakub Sitnicki
2018-10-05 21:35 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.