Re: [PATCH] module/decompress: Use ssize_t for the zstd decompressed size

From: Petr Pavlu

Date: Wed Nov 18 2026 - 09:25:39 EST


On 11/15/26 3:55 PM, Paul Menzel wrote:
> module_zstd_decompress() returns ssize_t, but keeps the decompressed
> size in the int retval. Output of 2 GiB or more becomes a negative
> value that is not an errno, and output of 4 GiB or more can also be
> truncated to a positive size smaller than the pages mapped to
> info->hdr. Declare retval as ssize_t like module_gzip_decompress() and
> module_xz_decompress() do, and print it with %zd.
>
> The Sashiko AI review found the same bug in the proposed LZ4 decoder,
> which is modelled on the zstd decoder [1].
>
> The x86_64 build boots in QEMU/KVM, and finit_module() with
> MODULE_INIT_COMPRESSED_FILE and module.sig_enforce=1 decompresses the
> 237 .ko.zst modules without error.
>
> Fixes: 169a58ad824d ("module/decompress: Support zstd in-kernel decompression")
> Link: https://sashiko.dev/#/patchset/20261113144233.193782-1-pmenzel@xxxxxxxxxxxxx?part=1 [1]
> Signed-off-by: Paul Menzel <pmenzel@xxxxxxxxxxxxx>

Looks ok to me. I've slightly simplified the commit description and
queued the patch on modules-next.

--
Thanks,
Petr