Re: [PATCH v2] zram: reject unrecognized type= values in recompress_store()
From: Sergey Senozhatsky
Date: Tue Apr 07 2026 - 21:41:40 EST
Adding Andrew on this:
Message-ID: <20260407153027.42425-1-astellman@xxxxxxxxxxxxxxxxxxx>
On (26/04/07 11:30), Andrew Stellman wrote:
[..]
> recompress_store() parses the type= parameter with three if statements
> checking for "idle", "huge", and "huge_idle". An unrecognized value
> silently falls through with mode left at 0, causing the recompression
> pass to run with no slot filter — processing all slots instead of the
> intended subset.
>
> Add a !mode check after the type parsing block to return -EINVAL for
> unrecognized values, consistent with the function's other parameter
> validation.
>
> Suggested-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
> Signed-off-by: Andrew Stellman <astellman@xxxxxxxxxxxxxxxxxxx>
> ---
Reviewed-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
Thank you.