aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWHR <whr@rivoreo.one>2024-05-01 00:40:38 +0800
committerTom Rini <trini@konsulko.com>2024-05-13 16:51:13 -0600
commit1466e065a94b3cd242f945f16c916a7f7da02985 (patch)
tree1e5cc1aa72ed4dfc2b01d4391cb5015ef8d3ef13
parentcd85e0d443a40fe5e0814023e1c976127b761351 (diff)
downloadu-boot-1466e065a94b3cd242f945f16c916a7f7da02985.zip
u-boot-1466e065a94b3cd242f945f16c916a7f7da02985.tar.gz
u-boot-1466e065a94b3cd242f945f16c916a7f7da02985.tar.bz2
zfs: fix function 'zlib_decompress' pointlessly calling itself
In order to prevent crashing due to infinite recursion and actually decompress the requested data, call the zlib function 'uncompress' instead. Signed-off-by: WHR <msl0000023508@gmail.com>
-rw-r--r--fs/zfs/zfs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/zfs/zfs.c b/fs/zfs/zfs.c
index 06221e6..9906d55 100644
--- a/fs/zfs/zfs.c
+++ b/fs/zfs/zfs.c
@@ -16,6 +16,7 @@
#include <linux/time.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
+#include <u-boot/zlib.h>
#include "zfs_common.h"
#include "div64.h"
@@ -182,7 +183,8 @@ static int
zlib_decompress(void *s, void *d,
uint32_t slen, uint32_t dlen)
{
- if (zlib_decompress(s, d, slen, dlen) < 0)
+ uLongf z_dest_len = dlen;
+ if (uncompress(d, &z_dest_len, s, slen) != Z_OK)
return ZFS_ERR_BAD_FS;
return ZFS_ERR_NONE;
}