* [PATCH net-next] vsock: use sizeof(struct sockaddr_storage) instead of magic value
@ 2025-08-12 1:59 Wang Liang
2025-08-14 0:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Wang Liang @ 2025-08-12 1:59 UTC (permalink / raw)
To: sgarzare, davem, edumazet, kuba, pabeni, horms
Cc: yuehaibing, zhangchangzhong, wangliang74, virtualization, netdev,
linux-kernel
Previous commit 230b183921ec ("net: Use standard structures for generic
socket address structures.") use 'struct sockaddr_storage address;'
to replace 'char address[MAX_SOCK_ADDR];'.
The macro MAX_SOCK_ADDR is removed by commit 01893c82b4e6 ("net: Remove
MAX_SOCK_ADDR constant").
The comment in vsock_getname() is outdated, use sizeof(struct
sockaddr_storage) instead of magic value 128.
Signed-off-by: Wang Liang <wangliang74@huawei.com>
---
net/vmw_vsock/af_vsock.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index ead6a3c14b87..f7b2d61d1d16 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1028,12 +1028,7 @@ static int vsock_getname(struct socket *sock,
vm_addr = &vsk->local_addr;
}
- /* 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
- * value here.
- */
- BUILD_BUG_ON(sizeof(*vm_addr) > 128);
+ BUILD_BUG_ON(sizeof(*vm_addr) > sizeof(struct sockaddr_storage));
memcpy(addr, vm_addr, sizeof(*vm_addr));
err = sizeof(*vm_addr);
--
2.33.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] vsock: use sizeof(struct sockaddr_storage) instead of magic value
2025-08-12 1:59 [PATCH net-next] vsock: use sizeof(struct sockaddr_storage) instead of magic value Wang Liang
@ 2025-08-14 0:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-14 0:10 UTC (permalink / raw)
To: Wang Liang
Cc: sgarzare, davem, edumazet, kuba, pabeni, horms, yuehaibing,
zhangchangzhong, virtualization, netdev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 12 Aug 2025 09:59:29 +0800 you wrote:
> Previous commit 230b183921ec ("net: Use standard structures for generic
> socket address structures.") use 'struct sockaddr_storage address;'
> to replace 'char address[MAX_SOCK_ADDR];'.
>
> The macro MAX_SOCK_ADDR is removed by commit 01893c82b4e6 ("net: Remove
> MAX_SOCK_ADDR constant").
>
> [...]
Here is the summary with links:
- [net-next] vsock: use sizeof(struct sockaddr_storage) instead of magic value
https://git.kernel.org/netdev/net-next/c/4d18083d6b2c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-14 0:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12 1:59 [PATCH net-next] vsock: use sizeof(struct sockaddr_storage) instead of magic value Wang Liang
2025-08-14 0:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).