Re: [PATCH v6 0/5] zram: fix zstd error paths and add parameter validation

Sergey Senozhatsky <[email protected]> Tue, 4 Aug 2026 18:53:25 +0900
Newsgroups org.kernel.vger.linux-block,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On (26/08/04 17:38), Haoqin Huang wrote:
> From: Haoqin Huang <[email protected]>
> 
> Patch 1 removes zstd_release_params() from both zstd_create() and
> zstd_setup_params() error paths -- the former is a layering violation
> in a per-CPU callback, the latter is redundant as zcomp_init() already
> calls release_params() on setup failure.
> 
> Patch 2 rejects zero-size dictionaries and prints distinct error
> messages for sz < 0 (returns the original error code) and sz == 0
> ("empty file"). Currently errors are silently swallowed.
> 
> Patch 3 adds pr_fmt to each backend file so that pr_err() messages
> are auto-prefixed with the algorithm name.
> 
> Patch 4 validates dict and level parameters in each backend's
> .setup_params(), rejecting unsupported combinations and out-of-range
> levels.
> 
> Patch 5 resets per-priority params on algorithm change before init.
> 
> Changes since v5:
>   - Patch 2: split pr_err into sz < 0 and sz == 0 branches
>   - New patch 3: add pr_fmt to all backends; tweak winbits message;
>     add missing SPDX headers to lz4 and lz4hc
>   - Patch 4: removed inline algo-name prefixes (now handled by pr_fmt);
>     added comment for lz4hc < 1 lower bound; added braces to if
>     branches for consistency

Reviewed-by: Sergey Senozhatsky <[email protected]>