From 1f4968289c9c0e2a1e850317ef173df11938b7f3 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 14 Nov 2019 17:32:22 +0100 Subject: [PATCH] pvck: check result of dev_get_size Don't use garbage value for later computations. --- tools/pvck.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/pvck.c b/tools/pvck.c index c197a9701..c9692b010 100644 --- a/tools/pvck.c +++ b/tools/pvck.c @@ -1468,7 +1468,8 @@ static int _dump_search(struct cmd_context *cmd, uint64_t dev_bytes; uint64_t extra_bytes; - dev_get_size(dev, &dev_sectors); + if (!dev_get_size(dev, &dev_sectors)) + return_ECMD_FAILED; dev_bytes = dev_sectors * 512; extra_bytes = dev_bytes % ONE_MB_IN_BYTES; -- 2.43.5