[PATCH] bloblist: fix pointer comparison in bloblist_apply_blobs()

Raymond Mao raymondmaoca at gmail.com
Sat May 2 00:35:12 CEST 2026


Hi Michal,

On Wed, Apr 29, 2026 at 2:30 AM Michal Simek <michal.simek at amd.com> wrote:
>
> 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 at amd.com>
> ---
>
>  common/bloblist.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/bloblist.c b/common/bloblist.c
> index afed968ce01d..d084be899588 100644
> --- a/common/bloblist.c
> +++ b/common/bloblist.c
> @@ -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;
>                         }
> --
> 2.43.0
>
> base-commit: e995dcb19c89c5c697b57380831167ff238b0d07

Thanks for the fix.
Reviewed-by: Raymond Mao <raymondmaoca at gmail.com>

Raymond


More information about the U-Boot mailing list