From: Ian Jackson Subject: [PATCH] Fix config file interpretation when pci= not specified Date: Thu, 4 Mar 2010 18:47:16 +0000 Message-ID: <19344.52.309885.160570@mariner.uk.xensource.com> References: <19341.26082.271923.152094@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <19341.26082.271923.152094@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org My code for interpreting the results of the new config parser has undefined behaviour in the case when pci=... is not specified. Bad luck meant it worked for me in my tests. This patch fixes it. Signed-off-by: Ian Jackson # HG changeset patch # User Ian Jackson # Date 1267728147 0 # Node ID 2c7d21b063a59bfcc5c327820ffe1b15cf6915ac # Parent 32c721712bcef07b8e24834abbf1f23ef49640ed xl: Fix undefined behaviour when pci not specified in input file diff -r 32c721712bce -r 2c7d21b063a5 tools/libxl/xl.c --- a/tools/libxl/xl.c Thu Mar 04 11:23:57 2010 +0000 +++ b/tools/libxl/xl.c Thu Mar 04 18:42:27 2010 +0000 @@ -590,7 +590,7 @@ if (!xlu_cfg_get_long (config, "pci_power_mgmt", &l)) pci_power_mgmt = l; - if (xlu_cfg_get_list (config, "pci", &pcis, 0)) { + if (!xlu_cfg_get_list (config, "pci", &pcis, 0)) { *num_pcidevs = 0; *pcidevs = NULL; while ((buf = xlu_cfg_get_listitem (pcis, *num_pcidevs)) != NULL) {