From ee2cb9835f4e4e685bdb5d764ab65cebb3db13f7 Mon Sep 17 00:00:00 2001 From: Eduardo Otubo Date: Wed, 29 Sep 2010 16:52:15 +0200 Subject: [PATCH] phyp: Checking for NULL values when building new guest When creating a new gust, the function phypBuildLpar() was not checking for NULL values src/phyp/phyp_driver.c: check the definition arguments to avoid a segmentation fault in phypBuildLpar() --- src/phyp/phyp_driver.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 8eeba73fb2..ab12392f27 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -3701,6 +3701,29 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def) int exit_status = 0; virBuffer buf = VIR_BUFFER_INITIALIZER; + if (!def->memory) { + PHYP_ERROR(VIR_ERR_XML_ERROR,"%s", + _("Field \"\" on the domain XML file is missing or has " + "invalid value.")); + goto err; + } + + if (!def->maxmem) { + PHYP_ERROR(VIR_ERR_XML_ERROR,"%s", + _("Field \"\" on the domain XML file is missing or" + " has invalid value.")); + goto err; + } + + if (def->ndisks > 0) { + if (!def->disks[0]->src) { + PHYP_ERROR(VIR_ERR_XML_ERROR,"%s", + _("Field \"\" under \"\" on the domain XML file is " + "missing.")); + goto err; + } + } + virBufferAddLit(&buf, "mksyscfg"); if (system_type == HMC) virBufferVSprintf(&buf, " -m %s", managed_system); -- GitLab