[PATCH] lib: fdtdec: Parse the gzip/lzo headers only when dependencies have met

From: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com
It might happen that CONFIG_GZIP and CONFIG_LZO are enabled but we might have CONFIG_MULTI_DTB_FIT_LZO enabled in this case in the code path of uncompress_blob() we parse the gzip headers first which results in `Error: Bad gzipped data` being printed. To avoid this parse the gzip/lzo headers only when dependencies have met.
Signed-off-by: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com --- lib/fdtdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 6865f78c70..52f431c197 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1172,10 +1172,10 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp) void *dst; int rc;
- if (CONFIG_IS_ENABLED(GZIP)) + if (CONFIG_IS_ENABLED(GZIP) && CONFIG_IS_ENABLED(MULTI_DTB_FIT_GZIP)) if (gzip_parse_header(src, sz_in) >= 0) gzip = 1; - if (CONFIG_IS_ENABLED(LZO)) + if (CONFIG_IS_ENABLED(LZO) && CONFIG_IS_ENABLED(MULTI_DTB_FIT_LZO)) if (!gzip && lzop_is_valid_header(src)) lzo = 1;

On Tue, Oct 01, 2024 at 10:56:47AM +0100, Prabhakar wrote:
From: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com
It might happen that CONFIG_GZIP and CONFIG_LZO are enabled but we might have CONFIG_MULTI_DTB_FIT_LZO enabled in this case in the code path of uncompress_blob() we parse the gzip headers first which results in `Error: Bad gzipped data` being printed. To avoid this parse the gzip/lzo headers only when dependencies have met.
Signed-off-by: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com
Reviewed-by: Tom Rini trini@konsulko.com

On Tue, 01 Oct 2024 10:56:47 +0100, Prabhakar wrote:
It might happen that CONFIG_GZIP and CONFIG_LZO are enabled but we might have CONFIG_MULTI_DTB_FIT_LZO enabled in this case in the code path of uncompress_blob() we parse the gzip headers first which results in `Error: Bad gzipped data` being printed. To avoid this parse the gzip/lzo headers only when dependencies have met.
[...]
Applied to u-boot/master, thanks!
participants (2)
-
Prabhakar
-
Tom Rini