On Fri, 21 Feb 2020 at 03:37, David Gibson <[email protected]> wrote:
>
> From: Shivaprasad G Bhat <[email protected]>
>
> Add support for NVDIMM devices for sPAPR. Piggyback on existing nvdimm
> device interface in QEMU to support virtual NVDIMM devices for Power.
> Create the required DT entries for the device (some entries have
> dummy values right now).
> +void spapr_nvdimm_validate_opts(NVDIMMDevice *nvdimm, uint64_t size,
> + Error **errp)
> +{
> + char *uuidstr = NULL;
> + QemuUUID uuid;
> +
> + if (size % SPAPR_MINIMUM_SCM_BLOCK_SIZE) {
> + error_setg(errp, "NVDIMM memory size excluding the label area"
> + " must be a multiple of %" PRIu64 "MB",
> + SPAPR_MINIMUM_SCM_BLOCK_SIZE / MiB);
> + return;
> + }
> +
> + uuidstr = object_property_get_str(OBJECT(nvdimm), NVDIMM_UUID_PROP,
> NULL);
> + qemu_uuid_parse(uuidstr, &uuid);
> + g_free(uuidstr);
> +
> + if (qemu_uuid_is_null(&uuid)) {
> + error_setg(errp, "NVDIMM device requires the uuid to be set");
> + return;
> + }
> +}
Hi -- Coverity thinks (CID 1419883) that it's suspicious that
this code doesn't check the return value of qemu_uuid_parse(),
because we check it everywhere else that we call that function
(it can return a failure code if the UUID doesn't validly parse).
thanks
-- PMM