mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
nwfilter: Alter virNWFilterSnoopReqLeaseDel logic
Move the fetch of @ipAddrLeft to after the goto skip_instantiate and remove the (req->binding) guard since we know that as long as req->binding is created, then req->threadkey is filled in. Found by Coverity Signed-off-by: John Ferlan <jferlan@redhat.com> ACKed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
f0982d5faa
commit
3a286a4e26
@ -846,7 +846,6 @@ virNWFilterSnoopReqLeaseDel(virNWFilterSnoopReqPtr req,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
virNWFilterSnoopIPLeasePtr ipl;
|
virNWFilterSnoopIPLeasePtr ipl;
|
||||||
char *ipstr = NULL;
|
char *ipstr = NULL;
|
||||||
int ipAddrLeft = 0;
|
|
||||||
|
|
||||||
/* protect req->start, req->ifname and the lease */
|
/* protect req->start, req->ifname and the lease */
|
||||||
virNWFilterSnoopReqLock(req);
|
virNWFilterSnoopReqLock(req);
|
||||||
@ -867,13 +866,13 @@ virNWFilterSnoopReqLeaseDel(virNWFilterSnoopReqPtr req,
|
|||||||
if (update_leasefile)
|
if (update_leasefile)
|
||||||
virNWFilterSnoopLeaseFileSave(ipl);
|
virNWFilterSnoopLeaseFileSave(ipl);
|
||||||
|
|
||||||
if (req->binding)
|
|
||||||
ipAddrLeft = virNWFilterIPAddrMapDelIPAddr(req->binding->portdevname, ipstr);
|
|
||||||
|
|
||||||
if (!req->threadkey || !instantiate)
|
if (!req->threadkey || !instantiate)
|
||||||
goto skip_instantiate;
|
goto skip_instantiate;
|
||||||
|
|
||||||
if (ipAddrLeft) {
|
/* Assumes that req->binding is valid since req->threadkey
|
||||||
|
* is only generated after req->binding is filled in during
|
||||||
|
* virNWFilterDHCPSnoopReq processing */
|
||||||
|
if ((virNWFilterIPAddrMapDelIPAddr(req->binding->portdevname, ipstr)) > 0) {
|
||||||
ret = virNWFilterInstantiateFilterLate(req->driver,
|
ret = virNWFilterInstantiateFilterLate(req->driver,
|
||||||
req->binding,
|
req->binding,
|
||||||
req->ifindex);
|
req->ifindex);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user