Skip to contentSkip to conversation

xentop: fix sigsegv

PATCH New Jeremy Fitzhardinge 1 participant 1 message May 19, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xentop: fix sigsegv

On my system, I'm getting SIGSEGVs in xentop because xenstat_node_domain() is returning NULL. Skip the loop if it does rather than crashing.

tools/xenstat/libxenstat/src/xenstat_linux.c +1 -1
diff -r 9dda78d7af3b -r 5895ad758076 tools/xenstat/libxenstat/src/xenstat_linux.c
@@ -294,7 +294,7 @@
 		/* likely using bonding so we alter the configuration for dom0 to have bridge stats */
 		if ((strstr(iface, devBridge) != NULL) && (strstr(iface, devNoBridge) == NULL)) {
 			domain = xenstat_node_domain(node, 0);
-			for (i = 0; i < domain->num_networks; i++) {
+			for (i = 0; domain && i < domain->num_networks; i++) {
 				if ((domain->networks[i].id == 0) && (domain->networks[i].tbytes == 0)
 					&& (domain->networks[i].rbytes == 0)) {
 						domain->networks[i].tbytes = txBytes;