qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vhost_net: add an assertion for TAP client backends
@ 2023-06-19  4:15 Ani Sinha
  2023-06-19  7:59 ` Laurent Vivier
  0 siblings, 1 reply; 2+ messages in thread
From: Ani Sinha @ 2023-06-19  4:15 UTC (permalink / raw)
  To: Michael S. Tsirkin, Jason Wang; +Cc: imammedo, Ani Sinha, qemu-devel

An assertion was missing for tap vhost backends that enforces a non-null
reference from get_vhost_net(). Both vhost-net-user and vhost-net-vdpa
enforces this. Enforce the same for tap. Unit tests pass with this change.

Signed-off-by: Ani Sinha <anisinha@redhat.com>
---
 hw/net/vhost_net.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index c4eecc6f36..6db23ca323 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -507,6 +507,7 @@ VHostNetState *get_vhost_net(NetClientState *nc)
     switch (nc->info->type) {
     case NET_CLIENT_DRIVER_TAP:
         vhost_net = tap_get_vhost_net(nc);
+        assert(vhost_net);
         break;
 #ifdef CONFIG_VHOST_NET_USER
     case NET_CLIENT_DRIVER_VHOST_USER:
-- 
2.39.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] vhost_net: add an assertion for TAP client backends
  2023-06-19  4:15 [PATCH] vhost_net: add an assertion for TAP client backends Ani Sinha
@ 2023-06-19  7:59 ` Laurent Vivier
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Vivier @ 2023-06-19  7:59 UTC (permalink / raw)
  To: Ani Sinha, Michael S. Tsirkin, Jason Wang; +Cc: imammedo, qemu-devel

On 6/19/23 06:15, Ani Sinha wrote:
> An assertion was missing for tap vhost backends that enforces a non-null
> reference from get_vhost_net(). Both vhost-net-user and vhost-net-vdpa
> enforces this. Enforce the same for tap. Unit tests pass with this change.
> 
> Signed-off-by: Ani Sinha <anisinha@redhat.com>
> ---
>   hw/net/vhost_net.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index c4eecc6f36..6db23ca323 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -507,6 +507,7 @@ VHostNetState *get_vhost_net(NetClientState *nc)
>       switch (nc->info->type) {
>       case NET_CLIENT_DRIVER_TAP:
>           vhost_net = tap_get_vhost_net(nc);
> +        assert(vhost_net);
>           break;
>   #ifdef CONFIG_VHOST_NET_USER
>       case NET_CLIENT_DRIVER_VHOST_USER:

Reviewed-by: Laurent Vivier <lvivier@redhat.com>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-19  7:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-19  4:15 [PATCH] vhost_net: add an assertion for TAP client backends Ani Sinha
2023-06-19  7:59 ` Laurent Vivier

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).