Thread (3 messages) 3 messages, 3 authors, 2025-07-26
STALE320d

[PATCH net-next] vsock: remove unnecessary null check in vsock_getname()

From: Wang Liang <hidden>
Date: 2025-07-25 01:16:42
Also in: lkml, virtualization
Subsystem: networking [general], the rest, vm sockets (af_vsock) · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds, Stefano Garzarella

The local variable 'vm_addr' is always not NULL, no need to check it.

Signed-off-by: Wang Liang <redacted>
---
 net/vmw_vsock/af_vsock.c | 5 -----
 1 file changed, 5 deletions(-)
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 1053662725f8..fae512594849 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1028,11 +1028,6 @@ static int vsock_getname(struct socket *sock,
 		vm_addr = &vsk->local_addr;
 	}
 
-	if (!vm_addr) {
-		err = -EINVAL;
-		goto out;
-	}
-
 	/* sys_getsockname() and sys_getpeername() pass us a
 	 * MAX_SOCK_ADDR-sized buffer and don't set addr_len.  Unfortunately
 	 * that macro is defined in socket.c instead of .h, so we hardcode its
-- 
2.34.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help