vhost_net: add an assertion for TAP client backends
PATCH 1/1 vhost_net: add an assertion for TAP client backends
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 <[email protected]>
--- hw/net/vhost_net.c | 1 + 1 file changed, 1 insertion(+)
hw/net/vhost_net.c +1 -0
@@ -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 :
Signature · 1 line
2.39.1
Quoted 14 lines · Ani Sinha
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 <[email protected]>--- hw/net/vhost_net.c | 1 + 1 file changed, 1 insertion(+)hw/net/vhost_net.c +0
-0
hw/net/vhost_net.c VHostNetState *get_vhost_net(NetClientState *nc) · line 513
Quoted 7 lines
hw/net/vhost_net.c +1
-0@@ -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 <[email protected]>