1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

util: netdevvlan: Change return type of virNetDevVlanCopy to void

This function return value is invariant since 1022e0ee, so change
its type and remove all dependent checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Alexander Rudyuk <a.rudyuk@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Alexander Kuznetsov 2025-03-07 12:08:03 +03:00 committed by Martin Kletzander
parent c4b7d29610
commit d23a516eba
4 changed files with 7 additions and 12 deletions

View File

@ -30561,8 +30561,7 @@ virDomainNetDefToNetworkPort(virDomainDef *dom,
if (virNetDevBandwidthCopy(&port->bandwidth, iface->bandwidth) < 0)
return NULL;
if (virNetDevVlanCopy(&port->vlan, &iface->vlan) < 0)
return NULL;
virNetDevVlanCopy(&port->vlan, &iface->vlan);
port->isolatedPort = iface->isolatedPort;
port->trustGuestRxFilters = iface->trustGuestRxFilters;
@ -30639,8 +30638,7 @@ virDomainNetDefActualFromNetworkPort(virDomainNetDef *iface,
if (virNetDevBandwidthCopy(&actual->bandwidth, port->bandwidth) < 0)
goto error;
if (virNetDevVlanCopy(&actual->vlan, &port->vlan) < 0)
goto error;
virNetDevVlanCopy(&actual->vlan, &port->vlan);
actual->isolatedPort = port->isolatedPort;
actual->class_id = port->class_id;
@ -30757,8 +30755,7 @@ virDomainNetDefActualToNetworkPort(virDomainDef *dom,
if (virNetDevBandwidthCopy(&port->bandwidth, actual->bandwidth) < 0)
return NULL;
if (virNetDevVlanCopy(&port->vlan, &actual->vlan) < 0)
return NULL;
virNetDevVlanCopy(&port->vlan, &actual->vlan);
port->isolatedPort = actual->isolatedPort;
port->class_id = actual->class_id;

View File

@ -3973,8 +3973,7 @@ networkAllocatePort(virNetworkObj *obj,
else if (netdef->vlan.nTags > 0)
vlan = &netdef->vlan;
if (vlan && virNetDevVlanCopy(&port->vlan, vlan) < 0)
return -1;
virNetDevVlanCopy(&port->vlan, vlan);
}
if (!port->trustGuestRxFilters) {

View File

@ -76,11 +76,11 @@ virNetDevVlanEqual(const virNetDevVlan *a, const virNetDevVlan *b)
* If src is NULL, dst will have nTags set to 0.
* dst is assumed to be empty on entry.
*/
int
void
virNetDevVlanCopy(virNetDevVlan *dst, const virNetDevVlan *src)
{
if (!src || src->nTags == 0)
return 0;
return;
dst->tag = g_new0(unsigned int, src->nTags);
dst->trunk = src->trunk;
@ -88,5 +88,4 @@ virNetDevVlanCopy(virNetDevVlan *dst, const virNetDevVlan *src)
dst->nativeMode = src->nativeMode;
dst->nativeTag = src->nativeTag;
memcpy(dst->tag, src->tag, src->nTags * sizeof(*src->tag));
return 0;
}

View File

@ -42,6 +42,6 @@ struct _virNetDevVlan {
void virNetDevVlanClear(virNetDevVlan *vlan);
void virNetDevVlanFree(virNetDevVlan *vlan);
int virNetDevVlanEqual(const virNetDevVlan *a, const virNetDevVlan *b);
int virNetDevVlanCopy(virNetDevVlan *dst, const virNetDevVlan *src);
void virNetDevVlanCopy(virNetDevVlan *dst, const virNetDevVlan *src);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetDevVlan, virNetDevVlanFree);