diff mbox series

[net,4/4] virtio/vsock: Put vsock_connected_sockets_vsk() to use

Message ID 20241106-vsock-mem-leaks-v1-4-8f4ffc3099e6@rbox.co (mailing list archive)
State New
Headers show
Series virtio/vsock: Fix memory leaks | expand

Commit Message

Michal Luczaj Nov. 6, 2024, 5:51 p.m. UTC
Macro vsock_connected_sockets_vsk() has been unused since its introduction.
Instead of removing it, utilise it in vsock_insert_connected() where it's
been open-coded.

No functional change intended.

Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
Signed-off-by: Michal Luczaj <mhal@rbox.co>
---
 net/vmw_vsock/af_vsock.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Stefano Garzarella Nov. 7, 2024, 10:22 a.m. UTC | #1
On Wed, Nov 06, 2024 at 06:51:21PM +0100, Michal Luczaj wrote:
>Macro vsock_connected_sockets_vsk() has been unused since its introduction.
>Instead of removing it, utilise it in vsock_insert_connected() where it's
>been open-coded.
>
>No functional change intended.
>
>Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")

This is not a fix, so please remove the Fixes tag, we don't need to 
backport this patch in stable branches.

Also in this case this is not related at all with virtio transport, so 
please remove `virtio` from the commit title.

In addition maybe you can remove this patch from this series, and send 
it to net-next.

Thanks,
Stefano

>Signed-off-by: Michal Luczaj <mhal@rbox.co>
>---
> net/vmw_vsock/af_vsock.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>index dfd29160fe11c4675f872c1ee123d65b2da0dae6..c3a37c3d4bf3c8117fbc8bd020da8dc1c9212732 100644
>--- a/net/vmw_vsock/af_vsock.c
>+++ b/net/vmw_vsock/af_vsock.c
>@@ -275,8 +275,7 @@ static void vsock_insert_unbound(struct vsock_sock *vsk)
>
> void vsock_insert_connected(struct vsock_sock *vsk)
> {
>-	struct list_head *list = vsock_connected_sockets(
>-		&vsk->remote_addr, &vsk->local_addr);
>+	struct list_head *list = vsock_connected_sockets_vsk(vsk);
>
> 	spin_lock_bh(&vsock_table_lock);
> 	__vsock_insert_connected(list, vsk);
>
>-- 
>2.46.2
>
Michal Luczaj Nov. 7, 2024, 9:04 p.m. UTC | #2
On 11/7/24 11:22, Stefano Garzarella wrote:
> On Wed, Nov 06, 2024 at 06:51:21PM +0100, Michal Luczaj wrote:
>> Macro vsock_connected_sockets_vsk() has been unused since its introduction.
>> Instead of removing it, utilise it in vsock_insert_connected() where it's
>> been open-coded.
>>
>> No functional change intended.
>>
>> Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
> 
> This is not a fix, so please remove the Fixes tag, we don't need to 
> backport this patch in stable branches.
> 
> Also in this case this is not related at all with virtio transport, so 
> please remove `virtio` from the commit title.
> 
> In addition maybe you can remove this patch from this series, and send 
> it to net-next.
> ...

Right, I get it. Just to be clear: are such small (and non-functional)
cleanups welcomed coming by themselves?

Thanks,
Michal
Stefano Garzarella Nov. 8, 2024, 9:21 a.m. UTC | #3
On Thu, Nov 07, 2024 at 10:04:03PM +0100, Michal Luczaj wrote:
>On 11/7/24 11:22, Stefano Garzarella wrote:
>> On Wed, Nov 06, 2024 at 06:51:21PM +0100, Michal Luczaj wrote:
>>> Macro vsock_connected_sockets_vsk() has been unused since its introduction.
>>> Instead of removing it, utilise it in vsock_insert_connected() where it's
>>> been open-coded.
>>>
>>> No functional change intended.
>>>
>>> Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
>>
>> This is not a fix, so please remove the Fixes tag, we don't need to
>> backport this patch in stable branches.
>>
>> Also in this case this is not related at all with virtio transport, so
>> please remove `virtio` from the commit title.
>>
>> In addition maybe you can remove this patch from this series, and send
>> it to net-next.
>> ...
>
>Right, I get it. Just to be clear: are such small (and non-functional)
>cleanups welcomed coming by themselves?

Good question, in this case I think it's a good cleanup, since we have 
the function already there, why not use it. So I don't see a problem 
with that.

If you find others cleanups, it's better to pack in a single series, 
otherwise let's send just it.

Thanks for the fixes and cleanups!

Stefano
diff mbox series

Patch

diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index dfd29160fe11c4675f872c1ee123d65b2da0dae6..c3a37c3d4bf3c8117fbc8bd020da8dc1c9212732 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -275,8 +275,7 @@  static void vsock_insert_unbound(struct vsock_sock *vsk)
 
 void vsock_insert_connected(struct vsock_sock *vsk)
 {
-	struct list_head *list = vsock_connected_sockets(
-		&vsk->remote_addr, &vsk->local_addr);
+	struct list_head *list = vsock_connected_sockets_vsk(vsk);
 
 	spin_lock_bh(&vsock_table_lock);
 	__vsock_insert_connected(list, vsk);