From 4e76da8ab138fedbae00a0bc80dad0f9f3cdf0ac Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Tue, 8 Sep 2020 13:23:05 +0000 Subject: [PATCH] storage: flash_map: Fix checking unsigned for negative value The unsigned size_t type variables have been checked for having negative values. Fixes #28171, Coverity-CID: 214224 Signed-off-by: Dominik Ermel --- subsys/storage/flash_map/flash_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/storage/flash_map/flash_map.c b/subsys/storage/flash_map/flash_map.c index 7e0c6f6143e..6bb678a00ec 100644 --- a/subsys/storage/flash_map/flash_map.c +++ b/subsys/storage/flash_map/flash_map.c @@ -281,8 +281,8 @@ int flash_area_check_int_sha256(const struct flash_area *fa, int pos; int rc; - if (!fa || !fac || !fac->match || !fac->rbuf || - fac->clen <= 0 || fac->off < 0 || fac->rblen <= 0) { + if (fa == NULL || fac == NULL || fac->match == NULL || + fac->rbuf == NULL || fac->clen == 0 || fac->rblen == 0) { return -EINVAL; }