From 9eaa7292e4bcf10149964cf8d5d3150bc6aabd45 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 28 Jan 2015 14:33:30 +0100 Subject: [PATCH] blockdev: check return when read from sysfs [coverity scan] Signed-off-by: Karel Zak --- disk-utils/blockdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c index 43aaef6d6b..ef6ee1d4d7 100644 --- a/disk-utils/blockdev.c +++ b/disk-utils/blockdev.c @@ -455,7 +455,10 @@ static void report_device(char *device, int quiet) err(EXIT_FAILURE, _("%s: failed to initialize sysfs handler"), device); - sysfs_read_u64(&cxt, "start", &start); + if (sysfs_read_u64(&cxt, "start", &start)) + err(EXIT_FAILURE, + _("%s: failed to read partition start from sysfs"), + device); sysfs_deinit(&cxt); } if (ioctl(fd, BLKROGET, &ro) == 0 && -- 2.47.3