From 30e27d2f8b8fbe3031c0e2863a22c77b577019a0 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 21 Sep 2021 18:46:52 +0200 Subject: [PATCH] cov: sanitize function environment Coverity can see that function is either used with 'dev' or 'def'. --- tools/pvck.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/pvck.c b/tools/pvck.c index 0d1bc1b17..b96b1c784 100644 --- a/tools/pvck.c +++ b/tools/pvck.c @@ -379,6 +379,9 @@ static bool _read_bytes(struct device *dev, struct devicefile *def, uint64_t sta if (dev) return dev_read_bytes(dev, start, len, data); + if (!def) + return false; + off = lseek(def->fd, start, SEEK_SET); if (off != start) return false;