[PATCH] cmd: zip: Add missing unmap_sysmem() for buffers in the unzip command
Marek Vasut
marek.vasut+renesas at mailbox.org
Wed Jan 28 20:42:03 CET 2026
Unmap the sysmem that got mapped by this command.
Use symbolic return value for the command while updating
the return value handling.
Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
---
Cc: Alexander Graf <agraf at csgraf.de>
Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
Cc: Jerome Forissier <jerome at forissier.org>
Cc: Mattijs Korpershoek <mkorpershoek at kernel.org>
Cc: Neil Armstrong <neil.armstrong at linaro.org>
Cc: Peng Fan <peng.fan at nxp.com>
Cc: Quentin Schulz <quentin.schulz at cherry.de>
Cc: Simon Glass <sjg at chromium.org>
Cc: Tom Rini <trini at konsulko.com>
Cc: Yuya Hamamachi <yuya.hamamachi.sx at renesas.com>
Cc: u-boot at lists.denx.de
---
cmd/unzip.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/cmd/unzip.c b/cmd/unzip.c
index ba83995040b..39af50f488d 100644
--- a/cmd/unzip.c
+++ b/cmd/unzip.c
@@ -16,6 +16,8 @@ static int do_unzip(struct cmd_tbl *cmdtp, int flag, int argc,
{
unsigned long src, dst;
unsigned long src_len = ~0UL, dst_len = ~0UL;
+ void *srcp, *dstp;
+ int ret;
switch (argc) {
case 4:
@@ -29,14 +31,21 @@ static int do_unzip(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
}
- if (gunzip(map_sysmem(dst, dst_len), dst_len, map_sysmem(src, 0),
- &src_len) != 0)
- return 1;
+ srcp = map_sysmem(dst, dst_len);
+ dstp = map_sysmem(src, 0);
+
+ ret = gunzip(srcp, dst_len, dstp, &src_len);
+
+ unmap_sysmem(dstp);
+ unmap_sysmem(srcp);
+
+ if (ret)
+ return CMD_RET_FAILURE;
printf("Uncompressed size: %lu = 0x%lX\n", src_len, src_len);
env_set_hex("filesize", src_len);
- return 0;
+ return CMD_RET_SUCCESS;
}
U_BOOT_CMD(
--
2.51.0
More information about the U-Boot
mailing list