mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-08 07:15:46 +00:00
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()
This commit is contained in:
parent
8bd11f37c4
commit
ee2cb9835f
@ -3701,6 +3701,29 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def)
|
|||||||
int exit_status = 0;
|
int exit_status = 0;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
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");
|
virBufferAddLit(&buf, "mksyscfg");
|
||||||
if (system_type == HMC)
|
if (system_type == HMC)
|
||||||
virBufferVSprintf(&buf, " -m %s", managed_system);
|
virBufferVSprintf(&buf, " -m %s", managed_system);
|
||||||
|
Loading…
Reference in New Issue
Block a user