2020-07-16 14:44:15 +08:00
|
|
|
From 10d448be7aa5dcdafcd4dabc782ce7308af89c30 Mon Sep 17 00:00:00 2001
|
2019-12-29 15:13:59 +08:00
|
|
|
From: Zdenek Kabelac <zkabelac@redhat.com>
|
|
|
|
|
Date: Tue, 25 Jun 2019 14:50:05 +0200
|
|
|
|
|
Subject: [PATCH] cov: check result of dev_read_bytes
|
|
|
|
|
|
|
|
|
|
---
|
2020-07-16 14:44:15 +08:00
|
|
|
lib/format_text/format-text.c | 10 +++++++---
|
|
|
|
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
2019-12-29 15:13:59 +08:00
|
|
|
|
|
|
|
|
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
|
2020-07-16 14:44:15 +08:00
|
|
|
index 268bd64..7385da5 100644
|
2019-12-29 15:13:59 +08:00
|
|
|
--- a/lib/format_text/format-text.c
|
|
|
|
|
+++ b/lib/format_text/format-text.c
|
2020-07-16 14:44:15 +08:00
|
|
|
@@ -1545,9 +1545,13 @@ int read_metadata_location_summary(const struct format_type *fmt,
|
2019-12-29 15:13:59 +08:00
|
|
|
|
|
|
|
|
memset(namebuf, 0, sizeof(namebuf));
|
2020-07-16 14:44:15 +08:00
|
|
|
|
2019-12-29 15:13:59 +08:00
|
|
|
- if (!dev_read_bytes(dev_area->dev, dev_area->start + rlocn->offset, NAME_LEN, namebuf))
|
|
|
|
|
- stack;
|
2020-07-16 14:44:15 +08:00
|
|
|
-
|
2019-12-29 15:13:59 +08:00
|
|
|
+ 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;
|
|
|
|
|
+ }
|
2020-07-16 14:44:15 +08:00
|
|
|
+
|
2019-12-29 15:13:59 +08:00
|
|
|
while (namebuf[len] && !isspace(namebuf[len]) && namebuf[len] != '{' &&
|
|
|
|
|
len < (NAME_LEN - 1))
|
|
|
|
|
len++;
|
|
|
|
|
--
|
2020-07-16 14:44:15 +08:00
|
|
|
1.8.3.1
|
2019-12-29 15:13:59 +08:00
|
|
|
|