[libvirt] [PATCHv3] PHYP: Checking for NULL values when building new guest
Eduardo Otubo
otubo at linux.vnet.ibm.com
Wed Aug 25 16:27:44 UTC 2010
When creating a new gust, the function phypBuildLpar() was not
checking for NULL values, making the driver to have a segmentation
fault.
---
src/phyp/phyp_driver.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 251111d..fcbb15e 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 \"<memory>\" on the domain XML file is missing or has "
+ "invalid value."));
+ goto err;
+ }
+
+ if (!def->maxmem) {
+ PHYP_ERROR(VIR_ERR_XML_ERROR,"%s",
+ _("Field \"<currentMemory>\" 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 \"<src>\" under \"<disk>\" on the domain XML file is "
+ "missing."));
+ goto err;
+ }
+ }
+
virBufferAddLit(&buf, "mksyscfg");
if (system_type == HMC)
virBufferVSprintf(&buf, " -m %s", managed_system);
--
1.7.0.4
More information about the libvir-list
mailing list