Re: [PATCH 2/3] zram: add per-backend capability flags and validate parameters early
From: Sergey Senozhatsky
Date: Fri Jul 24 2026 - 01:33:35 EST
On (26/06/27 15:02), Haoqin Huang wrote:
> Writing dict or level parameters for algorithms that don't support
> them was silently accepted but had no effect. Out-of-range levels
> were silently clamped by the underlying library. Dict read failures
> always lost the real error from kernel_read_file_from_path().
>
> Add caps, level_min and level_max to zcomp_ops and validate
> user-supplied parameters in algorithm_params_store() before storing,
> giving immediate error feedback. Also fix comp_params_store() to
> read the new dict into a temporary buffer before resetting old
> parameters, making the update atomic.
I probably would prefer not to add this. Again, zram setup is almost
always automated, you figure out what you need to put into your init
script once and you never touch it again.
The 0 i_size for CD-dict is something that simply should not happen.
If you insist on handling that then we can replace "sz < 0" with "sz <= 0",
but that 0 len dictionary case is something purely theoretical.