]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
bloblist: fix pointer comparison in bloblist_apply_blobs()
authorMichal Simek <michal.simek@amd.com>
Wed, 29 Apr 2026 06:29:53 +0000 (08:29 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 4 May 2026 18:58:44 +0000 (12:58 -0600)
The rec_from_blob() function returns a pointer, but the code was
comparing it using "rec <= 0" which is incorrect for pointer types.
Pointers should be compared using "== NULL" or "!= NULL".

Addresses-Coverity-ID: CID 645841: Incorrect expression (BAD_COMPARE)
Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Raymond Mao <raymondmaoca@gmail.com>
common/bloblist.c

index afed968ce01dc1bac278445344f6bd9b1ae966f3..d084be8995883ceb3f4b2b8b882a6ff301ba5b48 100644 (file)
@@ -300,7 +300,7 @@ int bloblist_apply_blobs(uint tag, int (*func)(void **data, int size))
                        }
 
                        rec = rec_from_blob(blob - dat_off);
-                       if (rec <= 0) {
+                       if (!rec) {
                                log_err("Blob corrupted\n");
                                return -ENOENT;
                        }