From 862899cc88e1697211d478de58b2ddc0eaec9cd9 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Tue, 25 Jun 2019 14:50:05 +0200
Subject: [PATCH] cov: check result of dev_read_bytes

---
 lib/format_text/format-text.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 1a6c3a3..9b08e14 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -1224,8 +1224,12 @@ int read_metadata_location_summary(const struct format_type *fmt,
 	}
 
 	memset(namebuf, 0, sizeof(namebuf));
-	if (!dev_read_bytes(dev_area->dev, dev_area->start + rlocn->offset, NAME_LEN, namebuf))
-		stack;
+	if (!dev_read_bytes(dev_area->dev, dev_area->start + rlocn->offset, NAME_LEN, namebuf)) {
+		log_error("Can't read metadata location on %s at %llu.",
+				  dev_name(dev_area->dev),
+				  (unsigned long long)(dev_area->start + rlocn->offset));
+		return 0;
+	}
 	while (namebuf[len] && !isspace(namebuf[len]) && namebuf[len] != '{' &&
 	       len < (NAME_LEN - 1))
 		len++;
-- 
2.19.1

