[PATCH 1/3] networkBandwidthUpdate: Don't blindly dereference pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It may happen that an interface don't have any bandwidth set and
a new one is to be set. In that case, @ifaceBand will be NULL.
This will cause troubles later in the code when deciding what to
do.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/network/bridge_driver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 666078c..f57c400 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -5048,8 +5048,8 @@ networkBandwidthUpdate(virDomainNetDefPtr iface,
 
     /* Okay, there are three possible scenarios: */
 
-    if (ifaceBand->in && ifaceBand->in->floor &&
-        newBandwidth->in && newBandwidth->in->floor) {
+    if (ifaceBand && ifaceBand->in && ifaceBand->in->floor &&
+        newBandwidth && newBandwidth->in && newBandwidth->in->floor) {
         /* Either we just need to update @floor .. */
 
         if (virNetDevBandwidthUpdateRate(network->def->bridge,
-- 
2.4.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]