From eafc5ff418184872e72b8a5d6fb872059bb89f86 Mon Sep 17 00:00:00 2001 From: Yifan Liu Date: Tue, 14 Jun 2022 06:18:07 +0000 Subject: [PATCH] dm: Coding style fix: Handle failure of parsing /proc/iomem In get_mmio_hpa_resource, although very unlikely, parsing of /proc/iomem may fail. Handle the case of failure and exit early. Tracked-On: #7593 Signed-off-by: Yifan Liu --- devicemodel/hw/mmio/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devicemodel/hw/mmio/core.c b/devicemodel/hw/mmio/core.c index 76926fdf3..4b5dabf78 100644 --- a/devicemodel/hw/mmio/core.c +++ b/devicemodel/hw/mmio/core.c @@ -137,6 +137,9 @@ int get_mmio_hpa_resource(char *name, uint64_t *res_start, uint64_t *res_size) pr_err("Please run acrn-dm with superuser privilege\n"); break; } + } else { + pr_err("Parsing /proc/iomem failed\n"); + break; } *res_start = start;