]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
zram: unify and harden algo/priority params handling
authorSergey Senozhatsky <senozhatsky@chromium.org>
Wed, 11 Mar 2026 08:42:49 +0000 (17:42 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 5 Apr 2026 20:53:25 +0000 (13:53 -0700)
commit301f3922009658ee353b3177bc186a12d36b8dd3
tree062a97e2366b2e6e474e12b642f53f52f493e700
parentcedfa028b54e584532026888dec94039b62b3d1f
zram: unify and harden algo/priority params handling

We have two functions that accept algo= and priority= params -
algorithm_params_store() and recompress_store().  This patch unifies and
hardens handling of those parameters.

There are 4 possible cases:

- only priority= provided [recommended]
  We need to verify that provided priority value is
  within permitted range for each particular function.

- both algo= and priority= provided
  We cannot prioritize one over another.  All we should
  do is to verify that zram is configured in the way
  that user-space expects it to be.  Namely that zram
  indeed has compressor algo= setup at given priority=.

- only algo= provided [not recommended]
  We should lookup priority in compressors list.

- none provided [not recommended]
  Just use function's defaults.

Link: https://lkml.kernel.org/r/20260311084312.1766036-7-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Suggested-by: Minchan Kim <minchan@kernel.org>
Cc: Brian Geffon <bgeffon@google.com>
Cc: gao xu <gaoxu2@honor.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/block/zram/zram_drv.c