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

Haoqin Huang <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.block
Message-ID <[email protected]>
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

v5: https://lore.kernel.org/all/[email protected]/

Haoqin Huang (5):
  zram: do not release zstd global params from error paths
  zram: reject zero-size dictionary
  zram: add pr_fmt to backend files
  zram: validate parameters in each backend's setup_params
  zram: reset per-priority params when changing algorithm before init

 drivers/block/zram/backend_842.c     | 10 +++++++++
 drivers/block/zram/backend_deflate.c | 17 ++++++++++++--
 drivers/block/zram/backend_lz4.c     | 10 ++++++++-
 drivers/block/zram/backend_lz4hc.c   | 16 +++++++++++++-
 drivers/block/zram/backend_lzo.c     | 10 +++++++++
 drivers/block/zram/backend_lzorle.c  | 10 +++++++++
 drivers/block/zram/backend_zstd.c    | 11 +++++++---
 drivers/block/zram/zram_drv.c        | 33 ++++++++++++++++++----------
 8 files changed, 98 insertions(+), 19 deletions(-)

-- 
2.43.7
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.