qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spapr: Fix Coverity warning while validating nvdimm options
@ 2020-02-26 12:10 Shivaprasad G Bhat
  2020-02-26 12:27 ` Philippe Mathieu-Daudé
  2020-02-26 12:49 ` Greg Kurz
  0 siblings, 2 replies; 5+ messages in thread
From: Shivaprasad G Bhat @ 2020-02-26 12:10 UTC (permalink / raw)
  To: qemu-ppc, david; +Cc: peter.maydell, qemu-devel

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.

Reported-by: Coverity (CID 1419883)
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
---
 hw/ppc/spapr_nvdimm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c
index 74eeb8bb74..051727536e 100644
--- a/hw/ppc/spapr_nvdimm.c
+++ b/hw/ppc/spapr_nvdimm.c
@@ -44,7 +44,7 @@ void spapr_nvdimm_validate_opts(NVDIMMDevice *nvdimm, uint64_t size,
     }
 
     uuidstr = object_property_get_str(OBJECT(nvdimm), NVDIMM_UUID_PROP, NULL);
-    qemu_uuid_parse(uuidstr, &uuid);
+    g_assert(qemu_uuid_parse(uuidstr, &uuid) == 0);
     g_free(uuidstr);
 
     if (qemu_uuid_is_null(&uuid)) {



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-27 13:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-26 12:10 [PATCH] spapr: Fix Coverity warning while validating nvdimm options Shivaprasad G Bhat
2020-02-26 12:27 ` Philippe Mathieu-Daudé
2020-02-26 12:49 ` Greg Kurz
2020-02-27 12:28   ` Greg Kurz
2020-02-27 13:44     ` Shivaprasad G Bhat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).