[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/45] spapr: Fix Coverity warning while validating nvdimm options
From: |
David Gibson |
Subject: |
[PULL 04/45] spapr: Fix Coverity warning while validating nvdimm options |
Date: |
Tue, 17 Mar 2020 21:03:42 +1100 |
From: Shivaprasad G Bhat <address@hidden>
Fixes Coverity issue,
CID 1419883: Error handling issues (CHECKED_RETURN)
Calling "qemu_uuid_parse" without checking return value
nvdimm_set_uuid() already verifies if the user provided uuid is valid or
not. So, need to check for the validity during pre-plug validation again.
As this a false positive in this case, assert if not valid to be safe.
Also, error_abort if QOM accessor encounters error while fetching the uuid
property.
Reported-by: Coverity (CID 1419883)
Signed-off-by: Shivaprasad G Bhat <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_nvdimm.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c
index 74eeb8bb74..25be8082d7 100644
--- a/hw/ppc/spapr_nvdimm.c
+++ b/hw/ppc/spapr_nvdimm.c
@@ -35,6 +35,7 @@ void spapr_nvdimm_validate_opts(NVDIMMDevice *nvdimm,
uint64_t size,
{
char *uuidstr = NULL;
QemuUUID uuid;
+ int ret;
if (size % SPAPR_MINIMUM_SCM_BLOCK_SIZE) {
error_setg(errp, "NVDIMM memory size excluding the label area"
@@ -43,8 +44,10 @@ void spapr_nvdimm_validate_opts(NVDIMMDevice *nvdimm,
uint64_t size,
return;
}
- uuidstr = object_property_get_str(OBJECT(nvdimm), NVDIMM_UUID_PROP, NULL);
- qemu_uuid_parse(uuidstr, &uuid);
+ uuidstr = object_property_get_str(OBJECT(nvdimm), NVDIMM_UUID_PROP,
+ &error_abort);
+ ret = qemu_uuid_parse(uuidstr, &uuid);
+ g_assert(!ret);
g_free(uuidstr);
if (qemu_uuid_is_null(&uuid)) {
--
2.24.1
- [PULL 00/45] ppc-for-5.0 queue 20200317, David Gibson, 2020/03/17
- [PULL 04/45] spapr: Fix Coverity warning while validating nvdimm options,
David Gibson <=
- [PULL 02/45] spapr: Handle pending hot plug/unplug requests at CAS, David Gibson, 2020/03/17
- [PULL 03/45] ppc: Officially deprecate the CPU "compat" property, David Gibson, 2020/03/17
- [PULL 05/45] hw/ppc/pnv: Fix typo in comment, David Gibson, 2020/03/17
- [PULL 10/45] spapr, ppc: Remove VPM0/RMLS hacks for POWER9, David Gibson, 2020/03/17
- [PULL 06/45] ppc: Remove stub support for 32-bit hypervisor mode, David Gibson, 2020/03/17
- [PULL 08/45] target/ppc: Correct handling of real mode accesses with vhyp on hash MMU, David Gibson, 2020/03/17
- [PULL 07/45] ppc: Remove stub of PPC970 HID4 implementation, David Gibson, 2020/03/17
- [PULL 12/45] target/ppc: Use class fields to simplify LPCR masking, David Gibson, 2020/03/17
- [PULL 09/45] target/ppc: Introduce ppc_hash64_use_vrma() helper, David Gibson, 2020/03/17
- [PULL 13/45] target/ppc: Streamline calculation of RMA limit from LPCR[RMLS], David Gibson, 2020/03/17