[PATCH] fdt: check fdt_pack() return value in fdtdec_apply_bloblist_dtos()

Raymond Mao raymondmaoca at gmail.com
Mon May 4 15:24:33 CEST 2026


Hi Michal,

On Wed, Apr 29, 2026 at 2:22 AM Michal Simek <michal.simek at amd.com> wrote:
>
> The fdt_pack() function can return an error code, but its return value
> was not being checked. Add proper error handling to propagate any
> failure.
>
> Also fix typo in comment: "Shink" -> "Shrink".
>
> Addresses-Coverity-ID: CID 645839: Error handling issues (CHECKED_RETURN)
> Signed-off-by: Michal Simek <michal.simek at amd.com>
> ---
>
>  lib/fdtdec.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index c6e13b6abefd..2d66860f6ed0 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -1781,8 +1781,11 @@ static int fdtdec_apply_bloblist_dtos(void)
>         if (ret)
>                 return ret;
>
> -       /* Shink the blob to the actual FDT size */
> -       fdt_pack(live_fdt);
> +       /* Shrink the blob to the actual FDT size */
> +       ret = fdt_pack(live_fdt);
> +       if (ret)
> +               return ret;
> +
>         return bloblist_resize(BLOBLISTT_CONTROL_FDT, fdt_totalsize(live_fdt));
>  }
>
> --
> 2.43.0
>
> base-commit: cffa552d648f84769f4d5d540f419173f10cb86e
> branch: debian-sent3

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

Raymond


More information about the U-Boot mailing list