AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/06/27 07:25 flow patch-triage
0m Args:
null

Results:
{
  "EnableConfigs": [
    "ZRAM",
    "ZRAM_MULTI_COMP",
    "ZRAM_BACKEND_LZ4",
    "ZRAM_BACKEND_LZ4HC",
    "ZRAM_BACKEND_ZSTD",
    "ZRAM_BACKEND_DEFLATE",
    "ZRAM_BACKEND_842",
    "ZRAM_BACKEND_LZO"
  ],
  "FocusSymbols": [
    "algorithm_params_store",
    "comp_params_store",
    "__comp_algorithm_store",
    "zcomp_get_caps",
    "zcomp_validate_level",
    "zstd_create"
  ],
  "Reasoning": "The patch modifies zram compression parameters handling. It adds capabilities and validation for compression levels and dictionary support. It also fixes a memory leak in `comp_params_store` and removes a redundant parameter release in `zstd_create`. These changes are functional and reachable from userspace via sysfs attributes like `algorithm_params`, `comp_algorithm`, and `recomp_algorithm`.",
  "WorthFuzzing": true
}

1/1 2026/06/27 07:25 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 34bf6770baa8520467fe3f1ac4351f421dcc9630\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Sat Jun 27 07:25:24 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/drivers/block/zram/backend_842.c b/drivers/block/zram/backend_842.c\nindex 10d9d5c60f5313..d796ebda1fa0d5 100644\n--- a/drivers/block/zram/backend_842.c\n+++ b/drivers/block/zram/backend_842.c\n@@ -57,5 +57,6 @@ const struct zcomp_ops backend_842 = {\n \t.destroy_ctx\t= destroy_842,\n \t.setup_params\t= setup_params_842,\n \t.release_params\t= release_params_842,\n+\t.caps\t\t= 0,\n \t.name\t\t= \"842\",\n };\ndiff --git a/drivers/block/zram/backend_deflate.c b/drivers/block/zram/backend_deflate.c\nindex f92a52a720d1e2..cedc3daad33af5 100644\n--- a/drivers/block/zram/backend_deflate.c\n+++ b/drivers/block/zram/backend_deflate.c\n@@ -144,5 +144,8 @@ const struct zcomp_ops backend_deflate = {\n \t.destroy_ctx\t= deflate_destroy,\n \t.setup_params\t= deflate_setup_params,\n \t.release_params\t= deflate_release_params,\n+\t.caps\t\t= ZCOMP_CAP_LEVEL,\n+\t.level_min\t= Z_DEFAULT_COMPRESSION,\n+\t.level_max\t= Z_BEST_COMPRESSION,\n \t.name\t\t= \"deflate\",\n };\ndiff --git a/drivers/block/zram/backend_lz4.c b/drivers/block/zram/backend_lz4.c\nindex c449d511ba86fe..bd1e5ca4d1342b 100644\n--- a/drivers/block/zram/backend_lz4.c\n+++ b/drivers/block/zram/backend_lz4.c\n@@ -146,5 +146,8 @@ const struct zcomp_ops backend_lz4 = {\n \t.destroy_ctx\t= lz4_destroy,\n \t.setup_params\t= lz4_setup_params,\n \t.release_params\t= lz4_release_params,\n+\t.caps\t\t= ZCOMP_CAP_DICT | ZCOMP_CAP_LEVEL,\n+\t.level_min\t= LZ4_ACCELERATION_DEFAULT,\n+\t.level_max\t= 65535,\n \t.name\t\t= \"lz4\",\n };\ndiff --git a/drivers/block/zram/backend_lz4hc.c b/drivers/block/zram/backend_lz4hc.c\nindex f6a336acfe202e..0e0d7c68a7d422 100644\n--- a/drivers/block/zram/backend_lz4hc.c\n+++ b/drivers/block/zram/backend_lz4hc.c\n@@ -124,5 +124,8 @@ const struct zcomp_ops backend_lz4hc = {\n \t.destroy_ctx\t= lz4hc_destroy,\n \t.setup_params\t= lz4hc_setup_params,\n \t.release_params\t= lz4hc_release_params,\n+\t.caps\t\t= ZCOMP_CAP_DICT | ZCOMP_CAP_LEVEL,\n+\t.level_min\t= LZ4HC_MIN_CLEVEL,\n+\t.level_max\t= LZ4HC_MAX_CLEVEL,\n \t.name\t\t= \"lz4hc\",\n };\ndiff --git a/drivers/block/zram/backend_lzo.c b/drivers/block/zram/backend_lzo.c\nindex 4c906beaae6b33..965f007e2ca898 100644\n--- a/drivers/block/zram/backend_lzo.c\n+++ b/drivers/block/zram/backend_lzo.c\n@@ -55,5 +55,6 @@ const struct zcomp_ops backend_lzo = {\n \t.destroy_ctx\t= lzo_destroy,\n \t.setup_params\t= lzo_setup_params,\n \t.release_params\t= lzo_release_params,\n+\t.caps\t\t= 0,\n \t.name\t\t= \"lzo\",\n };\ndiff --git a/drivers/block/zram/backend_lzorle.c b/drivers/block/zram/backend_lzorle.c\nindex 10640c96cbfcaa..757b4598be0304 100644\n--- a/drivers/block/zram/backend_lzorle.c\n+++ b/drivers/block/zram/backend_lzorle.c\n@@ -55,5 +55,6 @@ const struct zcomp_ops backend_lzorle = {\n \t.destroy_ctx\t= lzorle_destroy,\n \t.setup_params\t= lzorle_setup_params,\n \t.release_params\t= lzorle_release_params,\n+\t.caps\t\t= 0,\n \t.name\t\t= \"lzo-rle\",\n };\ndiff --git a/drivers/block/zram/backend_zstd.c b/drivers/block/zram/backend_zstd.c\nindex d00b548056dc2e..0fbd2460883a82 100644\n--- a/drivers/block/zram/backend_zstd.c\n+++ b/drivers/block/zram/backend_zstd.c\n@@ -161,7 +161,6 @@ static int zstd_create(struct zcomp_params *params, struct zcomp_ctx *ctx)\n \treturn 0;\n \n error:\n-\tzstd_release_params(params);\n \tzstd_destroy(ctx);\n \treturn -EINVAL;\n }\n@@ -213,5 +212,8 @@ const struct zcomp_ops backend_zstd = {\n \t.destroy_ctx\t= zstd_destroy,\n \t.setup_params\t= zstd_setup_params,\n \t.release_params\t= zstd_release_params,\n+\t.caps\t\t= ZCOMP_CAP_DICT | ZCOMP_CAP_LEVEL,\n+\t.level_min\t= (int)-ZSTD_TARGETLENGTH_MAX,\n+\t.level_max\t= ZSTD_MAX_CLEVEL,\n \t.name\t\t= \"zstd\",\n };\ndiff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c\nindex 974c4691887e6f..15de28b50d427f 100644\n--- a/drivers/block/zram/zcomp.c\n+++ b/drivers/block/zram/zcomp.c\n@@ -9,6 +9,9 @@\n #include \u003clinux/cpuhotplug.h\u003e\n #include \u003clinux/vmalloc.h\u003e\n #include \u003clinux/sysfs.h\u003e\n+#include \u003clinux/lz4.h\u003e\n+#include \u003clinux/zlib.h\u003e\n+#include \u003clinux/zstd.h\u003e\n \n #include \"zcomp.h\"\n \n@@ -94,6 +97,26 @@ const char *zcomp_lookup_backend_name(const char *comp)\n \treturn NULL;\n }\n \n+unsigned int zcomp_get_caps(const char *comp)\n+{\n+\tconst struct zcomp_ops *backend = lookup_backend_ops(comp);\n+\n+\treturn backend ? backend-\u003ecaps : 0;\n+}\n+\n+int zcomp_validate_level(const char *comp, s32 level)\n+{\n+\tconst struct zcomp_ops *backend = lookup_backend_ops(comp);\n+\n+\tif (!backend)\n+\t\treturn -EINVAL;\n+\tif (!(backend-\u003ecaps \u0026 ZCOMP_CAP_LEVEL))\n+\t\treturn -EOPNOTSUPP;\n+\tif (level \u003c backend-\u003elevel_min || level \u003e backend-\u003elevel_max)\n+\t\treturn -EINVAL;\n+\treturn 0;\n+}\n+\n /* show available compressors */\n ssize_t zcomp_available_show(const char *comp, char *buf, ssize_t at)\n {\ndiff --git a/drivers/block/zram/zcomp.h b/drivers/block/zram/zcomp.h\nindex 81a0f3f6ff4871..16f812a94c67d4 100644\n--- a/drivers/block/zram/zcomp.h\n+++ b/drivers/block/zram/zcomp.h\n@@ -7,6 +7,9 @@\n \n #define ZCOMP_PARAM_NOT_SET\tINT_MIN\n \n+#define ZCOMP_CAP_DICT\t\tBIT(0)\t/* dictionary support */\n+#define ZCOMP_CAP_LEVEL\t\tBIT(1)\t/* adjustable compression level */\n+\n struct deflate_params {\n \ts32 winbits;\n };\n@@ -66,6 +69,9 @@ struct zcomp_ops {\n \tint (*setup_params)(struct zcomp_params *params);\n \tvoid (*release_params)(struct zcomp_params *params);\n \n+\tunsigned int caps;\n+\ts32 level_min;\n+\ts32 level_max;\n \tconst char *name;\n };\n \n@@ -81,6 +87,8 @@ int zcomp_cpu_up_prepare(unsigned int cpu, struct hlist_node *node);\n int zcomp_cpu_dead(unsigned int cpu, struct hlist_node *node);\n ssize_t zcomp_available_show(const char *comp, char *buf, ssize_t at);\n const char *zcomp_lookup_backend_name(const char *comp);\n+unsigned int zcomp_get_caps(const char *comp);\n+int zcomp_validate_level(const char *comp, s32 level);\n \n struct zcomp *zcomp_create(const char *alg, struct zcomp_params *params);\n void zcomp_destroy(struct zcomp *comp);\ndiff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c\nindex ace65c586072ba..6b47586e8718c8 100644\n--- a/drivers/block/zram/zram_drv.c\n+++ b/drivers/block/zram/zram_drv.c\n@@ -57,6 +57,7 @@ static size_t huge_class_size;\n static const struct block_device_operations zram_devops;\n \n static void slot_free(struct zram *zram, u32 index);\n+static void comp_params_reset(struct zram *zram, u32 prio);\n #define slot_dep_map(zram, index) (\u0026(zram)-\u003etable[(index)].dep_map)\n \n static void slot_lock_init(struct zram *zram, u32 index)\n@@ -1681,6 +1682,7 @@ static int __comp_algorithm_store(struct zram *zram, u32 prio, const char *buf)\n \t}\n \n \tcomp_algorithm_set(zram, prio, alg);\n+\tcomp_params_reset(zram, prio);\n \treturn 0;\n }\n \n@@ -1699,21 +1701,24 @@ static int comp_params_store(struct zram *zram, u32 prio, s32 level,\n \t\t\t     const char *dict_path,\n \t\t\t     struct deflate_params *deflate_params)\n {\n+\tvoid *new_dict = NULL;\n \tssize_t sz = 0;\n \n-\tcomp_params_reset(zram, prio);\n-\n \tif (dict_path) {\n-\t\tsz = kernel_read_file_from_path(dict_path, 0,\n-\t\t\t\t\t\t\u0026zram-\u003eparams[prio].dict,\n-\t\t\t\t\t\tINT_MAX,\n-\t\t\t\t\t\tNULL,\n-\t\t\t\t\t\tREADING_POLICY);\n-\t\tif (sz \u003c 0)\n+\t\tsz = kernel_read_file_from_path(dict_path, 0, \u0026new_dict,\n+\t\t\t\t\t\tINT_MAX, NULL, READING_POLICY);\n+\t\tif (sz \u003c 0) {\n+\t\t\tvfree(new_dict);\n+\t\t\treturn sz;\n+\t\t} else if (sz == 0) {\n+\t\t\tvfree(new_dict);\n \t\t\treturn -EINVAL;\n+\t\t}\n \t}\n \n+\tcomp_params_reset(zram, prio);\n \tzram-\u003eparams[prio].dict_sz = sz;\n+\tzram-\u003eparams[prio].dict = new_dict;\n \tzram-\u003eparams[prio].level = level;\n \tzram-\u003eparams[prio].deflate.winbits = deflate_params-\u003ewinbits;\n \treturn 0;\n@@ -1794,6 +1799,19 @@ static ssize_t algorithm_params_store(struct device *dev,\n \t\t\treturn -EINVAL;\n \t}\n \n+\tif (zram-\u003ecomp_algs[prio]) {\n+\t\tunsigned int caps = zcomp_get_caps(zram-\u003ecomp_algs[prio]);\n+\n+\t\tif (dict_path \u0026\u0026 !(caps \u0026 ZCOMP_CAP_DICT))\n+\t\t\treturn -EOPNOTSUPP;\n+\n+\t\tif (level != ZCOMP_PARAM_NOT_SET) {\n+\t\t\tret = zcomp_validate_level(zram-\u003ecomp_algs[prio], level);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n \tret = comp_params_store(zram, prio, level, dict_path, \u0026deflate_params);\n \treturn ret ? ret : len;\n }\ndiff --git a/include/linux/zstd_lib.h b/include/linux/zstd_lib.h\nindex e295d4125dde84..f4b26844e53ade 100644\n--- a/include/linux/zstd_lib.h\n+++ b/include/linux/zstd_lib.h\n@@ -1241,6 +1241,7 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);\n #define ZSTD_SEARCHLOG_MIN        1\n #define ZSTD_MINMATCH_MAX         7   /* only for ZSTD_fast, other strategies are limited to 6 */\n #define ZSTD_MINMATCH_MIN         3   /* only for ZSTD_btopt+, faster strategies are limited to 4 */\n+#define ZSTD_MAX_CLEVEL\t\t22\n #define ZSTD_TARGETLENGTH_MAX    ZSTD_BLOCKSIZE_MAX\n #define ZSTD_TARGETLENGTH_MIN     0   /* note : comparing this constant to an unsigned results in a tautological test */\n #define ZSTD_STRATEGY_MIN        ZSTD_fast\ndiff --git a/lib/zstd/compress/clevels.h b/lib/zstd/compress/clevels.h\nindex 6ab8be6532efc0..db3b275b502e6c 100644\n--- a/lib/zstd/compress/clevels.h\n+++ b/lib/zstd/compress/clevels.h\n@@ -17,7 +17,6 @@\n \n /*-=====  Pre-defined compression levels  =====-*/\n \n-#define ZSTD_MAX_CLEVEL     22\n \n __attribute__((__unused__))\n \n"
}

2/1 2026/06/27 07:25 agent patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
{
  "EnableConfigs": [
    "ZRAM",
    "ZRAM_MULTI_COMP",
    "ZRAM_BACKEND_LZ4",
    "ZRAM_BACKEND_LZ4HC",
    "ZRAM_BACKEND_ZSTD",
    "ZRAM_BACKEND_DEFLATE",
    "ZRAM_BACKEND_842",
    "ZRAM_BACKEND_LZO"
  ],
  "FocusSymbols": [
    "algorithm_params_store",
    "comp_params_store",
    "__comp_algorithm_store",
    "zcomp_get_caps",
    "zcomp_validate_level",
    "zstd_create"
  ],
  "Reasoning": "The patch modifies zram compression parameters handling. It adds capabilities and validation for compression levels and dictionary support. It also fixes a memory leak in `comp_params_store` and removes a redundant parameter release in `zstd_create`. These changes are functional and reachable from userspace via sysfs attributes like `algorithm_params`, `comp_algorithm`, and `recomp_algorithm`.",
  "WorthFuzzing": true
}

Instruction:
You are an expert Linux kernel maintainer.
Your job is to review a provided patch series and determine
if it makes functional changes to the kernel that should be fuzzed.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively
use your code access tools to examine the actual source code and confirm any assumptions.

Return WorthFuzzing=false if the patch only contains:
- Modifications to Documentation/, Kconfig files, or code comments.
- Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints.
- Changes to numeric constants or macros that do not functionally alter execution flow.
- Code paths that are impossible to reach in virtualized environments like GCE or QEMU,
even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim).

If it modifies reachable core kernel logic, drivers, or architectures, use your code search
tools to verify the code can be executed, then return WorthFuzzing=true.

When returning WorthFuzzing=true, you MUST ALSO:
1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols.
   Avoid listing generic hot-path functions to prevent skewed test distributions.
2. Identify any specific CONFIG_ options required to properly test this new/modified feature.
   Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions.
   Do not list too generic configs (we already have them enabled). Only list those that
   specifically cover the modified code. List them in the EnableConfigs output array,
   and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
For your convenience, here is the diff of the changes:
commit 34bf6770baa8520467fe3f1ac4351f421dcc9630
Author: syz-cluster <triage@syzkaller.com>
Date:   Sat Jun 27 07:25:24 2026 +0000

    syz-cluster: applied patch under review

diff --git a/drivers/block/zram/backend_842.c b/drivers/block/zram/backend_842.c
index 10d9d5c60f5313..d796ebda1fa0d5 100644
--- a/drivers/block/zram/backend_842.c
+++ b/drivers/block/zram/backend_842.c
@@ -57,5 +57,6 @@ const struct zcomp_ops backend_842 = {
 	.destroy_ctx	= destroy_842,
 	.setup_params	= setup_params_842,
 	.release_params	= release_params_842,
+	.caps		= 0,
 	.name		= "842",
 };
diff --git a/drivers/block/zram/backend_deflate.c b/drivers/block/zram/backend_deflate.c
index f92a52a720d1e2..cedc3daad33af5 100644
--- a/drivers/block/zram/backend_deflate.c
+++ b/drivers/block/zram/backend_deflate.c
@@ -144,5 +144,8 @@ const struct zcomp_ops backend_deflate = {
 	.destroy_ctx	= deflate_destroy,
 	.setup_params	= deflate_setup_params,
 	.release_params	= deflate_release_params,
+	.caps		= ZCOMP_CAP_LEVEL,
+	.level_min	= Z_DEFAULT_COMPRESSION,
+	.level_max	= Z_BEST_COMPRESSION,
 	.name		= "deflate",
 };
diff --git a/drivers/block/zram/backend_lz4.c b/drivers/block/zram/backend_lz4.c
index c449d511ba86fe..bd1e5ca4d1342b 100644
--- a/drivers/block/zram/backend_lz4.c
+++ b/drivers/block/zram/backend_lz4.c
@@ -146,5 +146,8 @@ const struct zcomp_ops backend_lz4 = {
 	.destroy_ctx	= lz4_destroy,
 	.setup_params	= lz4_setup_params,
 	.release_params	= lz4_release_params,
+	.caps		= ZCOMP_CAP_DICT | ZCOMP_CAP_LEVEL,
+	.level_min	= LZ4_ACCELERATION_DEFAULT,
+	.level_max	= 65535,
 	.name		= "lz4",
 };
diff --git a/drivers/block/zram/backend_lz4hc.c b/drivers/block/zram/backend_lz4hc.c
index f6a336acfe202e..0e0d7c68a7d422 100644
--- a/drivers/block/zram/backend_lz4hc.c
+++ b/drivers/block/zram/backend_lz4hc.c
@@ -124,5 +124,8 @@ const struct zcomp_ops backend_lz4hc = {
 	.destroy_ctx	= lz4hc_destroy,
 	.setup_params	= lz4hc_setup_params,
 	.release_params	= lz4hc_release_params,
+	.caps		= ZCOMP_CAP_DICT | ZCOMP_CAP_LEVEL,
+	.level_min	= LZ4HC_MIN_CLEVEL,
+	.level_max	= LZ4HC_MAX_CLEVEL,
 	.name		= "lz4hc",
 };
diff --git a/drivers/block/zram/backend_lzo.c b/drivers/block/zram/backend_lzo.c
index 4c906beaae6b33..965f007e2ca898 100644
--- a/drivers/block/zram/backend_lzo.c
+++ b/drivers/block/zram/backend_lzo.c
@@ -55,5 +55,6 @@ const struct zcomp_ops backend_lzo = {
 	.destroy_ctx	= lzo_destroy,
 	.setup_params	= lzo_setup_params,
 	.release_params	= lzo_release_params,
+	.caps		= 0,
 	.name		= "lzo",
 };
diff --git a/drivers/block/zram/backend_lzorle.c b/drivers/block/zram/backend_lzorle.c
index 10640c96cbfcaa..757b4598be0304 100644
--- a/drivers/block/zram/backend_lzorle.c
+++ b/drivers/block/zram/backend_lzorle.c
@@ -55,5 +55,6 @@ const struct zcomp_ops backend_lzorle = {
 	.destroy_ctx	= lzorle_destroy,
 	.setup_params	= lzorle_setup_params,
 	.release_params	= lzorle_release_params,
+	.caps		= 0,
 	.name		= "lzo-rle",
 };
diff --git a/drivers/block/zram/backend_zstd.c b/drivers/block/zram/backend_zstd.c
index d00b548056dc2e..0fbd2460883a82 100644
--- a/drivers/block/zram/backend_zstd.c
+++ b/drivers/block/zram/backend_zstd.c
@@ -161,7 +161,6 @@ static int zstd_create(struct zcomp_params *params, struct zcomp_ctx *ctx)
 	return 0;
 
 error:
-	zstd_release_params(params);
 	zstd_destroy(ctx);
 	return -EINVAL;
 }
@@ -213,5 +212,8 @@ const struct zcomp_ops backend_zstd = {
 	.destroy_ctx	= zstd_destroy,
 	.setup_params	= zstd_setup_params,
 	.release_params	= zstd_release_params,
+	.caps		= ZCOMP_CAP_DICT | ZCOMP_CAP_LEVEL,
+	.level_min	= (int)-ZSTD_TARGETLENGTH_MAX,
+	.level_max	= ZSTD_MAX_CLEVEL,
 	.name		= "zstd",
 };
diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
index 974c4691887e6f..15de28b50d427f 100644
--- a/drivers/block/zram/zcomp.c
+++ b/drivers/block/zram/zcomp.c
@@ -9,6 +9,9 @@
 #include <linux/cpuhotplug.h>
 #include <linux/vmalloc.h>
 #include <linux/sysfs.h>
+#include <linux/lz4.h>
+#include <linux/zlib.h>
+#include <linux/zstd.h>
 
 #include "zcomp.h"
 
@@ -94,6 +97,26 @@ const char *zcomp_lookup_backend_name(const char *comp)
 	return NULL;
 }
 
+unsigned int zcomp_get_caps(const char *comp)
+{
+	const struct zcomp_ops *backend = lookup_backend_ops(comp);
+
+	return backend ? backend->caps : 0;
+}
+
+int zcomp_validate_level(const char *comp, s32 level)
+{
+	const struct zcomp_ops *backend = lookup_backend_ops(comp);
+
+	if (!backend)
+		return -EINVAL;
+	if (!(backend->caps & ZCOMP_CAP_LEVEL))
+		return -EOPNOTSUPP;
+	if (level < backend->level_min || level > backend->level_max)
+		return -EINVAL;
+	return 0;
+}
+
 /* show available compressors */
 ssize_t zcomp_available_show(const char *comp, char *buf, ssize_t at)
 {
diff --git a/drivers/block/zram/zcomp.h b/drivers/block/zram/zcomp.h
index 81a0f3f6ff4871..16f812a94c67d4 100644
--- a/drivers/block/zram/zcomp.h
+++ b/drivers/block/zram/zcomp.h
@@ -7,6 +7,9 @@
 
 #define ZCOMP_PARAM_NOT_SET	INT_MIN
 
+#define ZCOMP_CAP_DICT		BIT(0)	/* dictionary support */
+#define ZCOMP_CAP_LEVEL		BIT(1)	/* adjustable compression level */
+
 struct deflate_params {
 	s32 winbits;
 };
@@ -66,6 +69,9 @@ struct zcomp_ops {
 	int (*setup_params)(struct zcomp_params *params);
 	void (*release_params)(struct zcomp_params *params);
 
+	unsigned int caps;
+	s32 level_min;
+	s32 level_max;
 	const char *name;
 };
 
@@ -81,6 +87,8 @@ int zcomp_cpu_up_prepare(unsigned int cpu, struct hlist_node *node);
 int zcomp_cpu_dead(unsigned int cpu, struct hlist_node *node);
 ssize_t zcomp_available_show(const char *comp, char *buf, ssize_t at);
 const char *zcomp_lookup_backend_name(const char *comp);
+unsigned int zcomp_get_caps(const char *comp);
+int zcomp_validate_level(const char *comp, s32 level);
 
 struct zcomp *zcomp_create(const char *alg, struct zcomp_params *params);
 void zcomp_destroy(struct zcomp *comp);
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index ace65c586072ba..6b47586e8718c8 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -57,6 +57,7 @@ static size_t huge_class_size;
 static const struct block_device_operations zram_devops;
 
 static void slot_free(struct zram *zram, u32 index);
+static void comp_params_reset(struct zram *zram, u32 prio);
 #define slot_dep_map(zram, index) (&(zram)->table[(index)].dep_map)
 
 static void slot_lock_init(struct zram *zram, u32 index)
@@ -1681,6 +1682,7 @@ static int __comp_algorithm_store(struct zram *zram, u32 prio, const char *buf)
 	}
 
 	comp_algorithm_set(zram, prio, alg);
+	comp_params_reset(zram, prio);
 	return 0;
 }
 
@@ -1699,21 +1701,24 @@ static int comp_params_store(struct zram *zram, u32 prio, s32 level,
 			     const char *dict_path,
 			     struct deflate_params *deflate_params)
 {
+	void *new_dict = NULL;
 	ssize_t sz = 0;
 
-	comp_params_reset(zram, prio);
-
 	if (dict_path) {
-		sz = kernel_read_file_from_path(dict_path, 0,
-						&zram->params[prio].dict,
-						INT_MAX,
-						NULL,
-						READING_POLICY);
-		if (sz < 0)
+		sz = kernel_read_file_from_path(dict_path, 0, &new_dict,
+						INT_MAX, NULL, READING_POLICY);
+		if (sz < 0) {
+			vfree(new_dict);
+			return sz;
+		} else if (sz == 0) {
+			vfree(new_dict);
 			return -EINVAL;
+		}
 	}
 
+	comp_params_reset(zram, prio);
 	zram->params[prio].dict_sz = sz;
+	zram->params[prio].dict = new_dict;
 	zram->params[prio].level = level;
 	zram->params[prio].deflate.winbits = deflate_params->winbits;
 	return 0;
@@ -1794,6 +1799,19 @@ static ssize_t algorithm_params_store(struct device *dev,
 			return -EINVAL;
 	}
 
+	if (zram->comp_algs[prio]) {
+		unsigned int caps = zcomp_get_caps(zram->comp_algs[prio]);
+
+		if (dict_path && !(caps & ZCOMP_CAP_DICT))
+			return -EOPNOTSUPP;
+
+		if (level != ZCOMP_PARAM_NOT_SET) {
+			ret = zcomp_validate_level(zram->comp_algs[prio], level);
+			if (ret)
+				return ret;
+		}
+	}
+
 	ret = comp_params_store(zram, prio, level, dict_path, &deflate_params);
 	return ret ? ret : len;
 }
diff --git a/include/linux/zstd_lib.h b/include/linux/zstd_lib.h
index e295d4125dde84..f4b26844e53ade 100644
--- a/include/linux/zstd_lib.h
+++ b/include/linux/zstd_lib.h
@@ -1241,6 +1241,7 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
 #define ZSTD_SEARCHLOG_MIN        1
 #define ZSTD_MINMATCH_MAX         7   /* only for ZSTD_fast, other strategies are limited to 6 */
 #define ZSTD_MINMATCH_MIN         3   /* only for ZSTD_btopt+, faster strategies are limited to 4 */
+#define ZSTD_MAX_CLEVEL		22
 #define ZSTD_TARGETLENGTH_MAX    ZSTD_BLOCKSIZE_MAX
 #define ZSTD_TARGETLENGTH_MIN     0   /* note : comparing this constant to an unsigned results in a tautological test */
 #define ZSTD_STRATEGY_MIN        ZSTD_fast
diff --git a/lib/zstd/compress/clevels.h b/lib/zstd/compress/clevels.h
index 6ab8be6532efc0..db3b275b502e6c 100644
--- a/lib/zstd/compress/clevels.h
+++ b/lib/zstd/compress/clevels.h
@@ -17,7 +17,6 @@
 
 /*-=====  Pre-defined compression levels  =====-*/
 
-#define ZSTD_MAX_CLEVEL     22
 
 __attribute__((__unused__))
 

3/2 2026/06/27 07:25 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 5584
							output: 27
							thoughts: 294
						

Thoughts:
**My Assessment of the Zram Patch**

Okay, so I've got this patch here that's making some pretty significant changes to the `zram` driver, specifically within `drivers/block/zram/`. It's introducing new compression backend capabilities - think 842, deflate, lz4, lz4hc, lzo, lzorle, and zstd - which is great to see. The core of this seems to be the addition of `caps`, `level_min`, and `level_max` to the `struct zcomp_ops`, along with `zcomp_get_caps()` and `zcomp_validate_level()` functions in `zcomp.c`.

My initial thought is to make sure this is all valid and working as it should. The core of the functionality hinges on `zram_drv.c`, specifically the validation routines it's adding for compression levels and dictionary support. It’s a good thing, a sanity check, when storing algorithm parameters. Plus, and this is important, I see it's also addressing a potential memory leak or a similar issue within `comp_params_store`. They're now using `new_dict` and freeing it on error, and they're resetting parameters correctly. And they've smartly removed `zstd_release_params(params)` from the `zstd_create` error path - that's a classic trap, and they've avoided it!

Now, let's see if this is reachable. *Yes*, the changes within the `zram` driver mean it's absolutely reachable via sysfs, particularly through `algorithm_params_store`. From an initial functional standpoint, it looks sound. The validation checks, the memory leak fix... all positive signs.

Right, so to make sure it's all hooked in correctly, I need to check the configuration options. Looks like the primary config variable is `CONFIG_ZRAM`, of course. I'll need to drill down into either `drivers/block/zram/Kconfig` or `drivers/block/Kconfig` to confirm everything is correctly enabled and configured based on this patch.



4/2 2026/06/27 07:25 tool grepper
0m Args:
{
  "Expression": "config ZRAM",
  "PathPrefix": "drivers/block/"
}

Results:
{
  "Output": "drivers/block/zram/Kconfig-1-# SPDX-License-Identifier: GPL-2.0\ndrivers/block/zram/Kconfig:2:config ZRAM\ndrivers/block/zram/Kconfig-3-\ttristate \"Compressed RAM block device support\"\n--\ndrivers/block/zram/Kconfig-16-\ndrivers/block/zram/Kconfig:17:config ZRAM_BACKEND_LZ4\ndrivers/block/zram/Kconfig-18-\tbool \"lz4 compression support\"\n--\ndrivers/block/zram/Kconfig-22-\ndrivers/block/zram/Kconfig:23:config ZRAM_BACKEND_LZ4HC\ndrivers/block/zram/Kconfig-24-\tbool \"lz4hc compression support\"\n--\ndrivers/block/zram/Kconfig-28-\ndrivers/block/zram/Kconfig:29:config ZRAM_BACKEND_ZSTD\ndrivers/block/zram/Kconfig-30-\tbool \"zstd compression support\"\n--\ndrivers/block/zram/Kconfig-34-\ndrivers/block/zram/Kconfig:35:config ZRAM_BACKEND_DEFLATE\ndrivers/block/zram/Kconfig-36-\tbool \"deflate compression support\"\n--\ndrivers/block/zram/Kconfig-40-\ndrivers/block/zram/Kconfig:41:config ZRAM_BACKEND_842\ndrivers/block/zram/Kconfig-42-\tbool \"842 compression support\"\n--\ndrivers/block/zram/Kconfig-46-\ndrivers/block/zram/Kconfig:47:config ZRAM_BACKEND_FORCE_LZO\ndrivers/block/zram/Kconfig-48-\tdepends on ZRAM\n--\ndrivers/block/zram/Kconfig-52-\ndrivers/block/zram/Kconfig:53:config ZRAM_BACKEND_LZO\ndrivers/block/zram/Kconfig-54-\tbool \"lzo and lzo-rle compression support\" if !ZRAM_BACKEND_FORCE_LZO\n--\ndrivers/block/zram/Kconfig=60=choice\n--\ndrivers/block/zram/Kconfig-64-\ndrivers/block/zram/Kconfig:65:config ZRAM_DEF_COMP_LZORLE\ndrivers/block/zram/Kconfig-66-\tbool \"lzo-rle\"\n--\ndrivers/block/zram/Kconfig-68-\ndrivers/block/zram/Kconfig:69:config ZRAM_DEF_COMP_LZO\ndrivers/block/zram/Kconfig-70-\tbool \"lzo\"\n--\ndrivers/block/zram/Kconfig-72-\ndrivers/block/zram/Kconfig:73:config ZRAM_DEF_COMP_LZ4\ndrivers/block/zram/Kconfig-74-\tbool \"lz4\"\n--\ndrivers/block/zram/Kconfig-76-\ndrivers/block/zram/Kconfig:77:config ZRAM_DEF_COMP_LZ4HC\ndrivers/block/zram/Kconfig-78-\tbool \"lz4hc\"\n--\ndrivers/block/zram/Kconfig-80-\ndrivers/block/zram/Kconfig:81:config ZRAM_DEF_COMP_ZSTD\ndrivers/block/zram/Kconfig-82-\tbool \"zstd\"\n--\ndrivers/block/zram/Kconfig-84-\ndrivers/block/zram/Kconfig:85:config ZRAM_DEF_COMP_DEFLATE\ndrivers/block/zram/Kconfig-86-\tbool \"deflate\"\n--\ndrivers/block/zram/Kconfig-88-\ndrivers/block/zram/Kconfig:89:config ZRAM_DEF_COMP_842\ndrivers/block/zram/Kconfig-90-\tbool \"842\"\n--\ndrivers/block/zram/Kconfig=93=endchoice\ndrivers/block/zram/Kconfig-94-\ndrivers/block/zram/Kconfig:95:config ZRAM_DEF_COMP\ndrivers/block/zram/Kconfig-96-\tstring\n--\ndrivers/block/zram/Kconfig-106-\ndrivers/block/zram/Kconfig:107:config ZRAM_WRITEBACK\ndrivers/block/zram/Kconfig-108-       bool \"Write back incompressible or idle page to backing device\"\n--\ndrivers/block/zram/Kconfig-120-\ndrivers/block/zram/Kconfig:121:config ZRAM_TRACK_ENTRY_ACTIME\ndrivers/block/zram/Kconfig-122-\tbool \"Track access time of zram entries\"\n--\ndrivers/block/zram/Kconfig-128-\ndrivers/block/zram/Kconfig:129:config ZRAM_MEMORY_TRACKING\ndrivers/block/zram/Kconfig-130-\tbool \"Track zRam block status\"\n--\ndrivers/block/zram/Kconfig-139-\ndrivers/block/zram/Kconfig:140:config ZRAM_MULTI_COMP\ndrivers/block/zram/Kconfig-141-\tbool \"Enable multiple compression streams\"\n"
}

5/2 2026/06/27 07:25 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 7662
							output: 38
							thoughts: 39
						

Thoughts:
Okay, here's my take on those modifications.

**Analyzing the Zram Patch**

Alright, so this patch hits `zram_drv.c`, `zcomp.c`, and a bunch of backend files. That's a good place to start, hitting the core driver, the compression routines, and likely the block device interaction. Let's dig into `zram_drv.c` first. I want to see which functions were touched there. That file is the heart of the block device emulation, so any changes there are going to be critical to understand. I'll need to know *what* they modified in that crucial file to grasp the implications across the entire subsystem. This is where the rubber meets the road.



6/2 2026/06/27 07:25 tool grepper
0m Args:
{
  "Expression": "algorithm_params_store",
  "PathPrefix": "drivers/block/zram/zram_drv.c"
}

Results:
{
  "Output": "drivers/block/zram/zram_drv.c=1700=static int comp_params_store(struct zram *zram, u32 prio, s32 level,\n--\ndrivers/block/zram/zram_drv.c-1726-\ndrivers/block/zram/zram_drv.c:1727:static ssize_t algorithm_params_store(struct device *dev,\ndrivers/block/zram/zram_drv.c-1728-\t\t\t\t      struct device_attribute *attr,\n"
}

7/2 2026/06/27 07:25 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 8037
							output: 38
							thoughts: 20
						

Thoughts:
Okay, here's my take on those thoughts, tailored for an expert audience:

**Analyzing Parameter and Algorithm Storage**

Alright, time to dig in. My initial thought is to zero in on two key storage locations: `comp_params_store` and `__comp_algorithm_store`. It's pretty standard to keep parameters separate from the algorithms themselves, especially in more complex computational setups. I need to understand how the parameters are being organized in `comp_params_store`. Is it a key-value store? Structured data? How is it indexed, if at all? The goal is to see if I can trace how specific parameter sets are tied to particular computational models.

Next, the `__comp_algorithm_store`...the double underscore suggests it's a private or internal component. No problem, that's fine. What’s important is how algorithms are *represented* within this store. Are we talking about function pointers? Serialized code objects? Abstract representations that need to be interpreted by a specific engine? The level of abstraction here is key to understanding the flexibility and extensibility of the system. I will need to understand the relationship between these two, how the parameters in the first are applied to the algorithm in the second.



8/2 2026/06/27 07:25 tool grepper
0m Args:
{
  "Expression": "comp_params_store",
  "PathPrefix": "drivers/block/zram/zram_drv.c"
}

Results:
{
  "Output": "drivers/block/zram/zram_drv.c=1689=static void comp_params_reset(struct zram *zram, u32 prio)\n--\ndrivers/block/zram/zram_drv.c-1699-\ndrivers/block/zram/zram_drv.c:1700:static int comp_params_store(struct zram *zram, u32 prio, s32 level,\ndrivers/block/zram/zram_drv.c-1701-\t\t\t     const char *dict_path,\n--\ndrivers/block/zram/zram_drv.c=1727=static ssize_t algorithm_params_store(struct device *dev,\n--\ndrivers/block/zram/zram_drv.c-1814-\ndrivers/block/zram/zram_drv.c:1815:\tret = comp_params_store(zram, prio, level, dict_path, \u0026deflate_params);\ndrivers/block/zram/zram_drv.c-1816-\treturn ret ? ret : len;\n"
}

9/2 2026/06/27 07:25 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 8638
							output: 39
							thoughts: 12
						

Thoughts:
Here's my take on those thoughts, tailored for an expert like yourself:

**Analyzing the Algorithm Store**

Alright, let's dive into this. My initial thought is to immediately examine the `__comp_algorithm_store`. That's where I would expect the core of this whole thing to live, wouldn't you? This is the central repository, the operational heart of the system when it comes to computation. My immediate instinct is to look at how it's structured, its access methods, and, of course, the algorithms themselves. What kind of metadata does it have? Versioning? Dependency management? Are the algorithms dynamically loaded or statically linked? Are there any obvious performance bottlenecks in the store itself? What are the implications of the store's design on system scalability and maintainability? I'm already anticipating questions about potential concurrency issues and security implications if this is not handled correctly. The design of this store is paramount to the entire operation.



10/2 2026/06/27 07:25 tool grepper
0m Args:
{
  "Expression": "__comp_algorithm_store",
  "PathPrefix": "drivers/block/zram/zram_drv.c"
}

Results:
{
  "Output": "drivers/block/zram/zram_drv.c=1660=static void comp_algorithm_set(struct zram *zram, u32 prio, const char *alg)\n--\ndrivers/block/zram/zram_drv.c-1664-\ndrivers/block/zram/zram_drv.c:1665:static int __comp_algorithm_store(struct zram *zram, u32 prio, const char *buf)\ndrivers/block/zram/zram_drv.c-1666-{\n--\ndrivers/block/zram/zram_drv.c=1831=static ssize_t comp_algorithm_store(struct device *dev,\n--\ndrivers/block/zram/zram_drv.c-1838-\ndrivers/block/zram/zram_drv.c:1839:\tret = __comp_algorithm_store(zram, ZRAM_PRIMARY_COMP, buf);\ndrivers/block/zram/zram_drv.c-1840-\treturn ret ? ret : len;\n--\ndrivers/block/zram/zram_drv.c=1863=static ssize_t recomp_algorithm_store(struct device *dev,\n--\ndrivers/block/zram/zram_drv.c-1899-\ndrivers/block/zram/zram_drv.c:1900:\tret = __comp_algorithm_store(zram, prio, alg);\ndrivers/block/zram/zram_drv.c-1901-\treturn ret ? ret : len;\n"
}

11/2 2026/06/27 07:25 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 9288
							output: 38
							thoughts: 198
						

Thoughts:
**Fuzzing ZRAM Algorithm Parameter Handling**

Okay, so I've been reviewing this patch and immediately, my expert eye goes to the system file store functions: `algorithm_params_store`, `comp_algorithm_store`, and `recomp_algorithm_store`. These are the entry points – the gateways – userspace utilizes via `/sys/block/zramX/algo_params` or similar sysfs nodes.

This patch, specifically, introduces two new functions, `zcomp_get_caps` and `zcomp_validate_level`. Plus, it touches `comp_params_store` to address a memory leak issue. Apparently, they were using `new_dict` when they should have been writing directly to `zram->params[prio].dict`.

This screams fuzzing target. Those store functions and new functions are prime candidates for finding vulnerabilities. I need to focus my fuzzing efforts on:

*   `algorithm_params_store`
*   `comp_params_store`
*   `__comp_algorithm_store` (That double underscore is a bit of a flag, too.)
*   `zcomp_get_caps`
*   `zcomp_validate_level`

Before I get too deep into this, I should verify the exact name of `algorithm_params_store`. Need to make sure I am working with the correct symbol.



12/2 2026/06/27 07:25 tool grepper
0m Args:
{
  "Expression": "algorithm_params_store",
  "PathPrefix": "drivers/block/zram/zram_drv.c"
}

Results:
{
  "Output": "drivers/block/zram/zram_drv.c=1700=static int comp_params_store(struct zram *zram, u32 prio, s32 level,\n--\ndrivers/block/zram/zram_drv.c-1726-\ndrivers/block/zram/zram_drv.c:1727:static ssize_t algorithm_params_store(struct device *dev,\ndrivers/block/zram/zram_drv.c-1728-\t\t\t\t      struct device_attribute *attr,\n"
}

13/2 2026/06/27 07:25 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 9965
							output: 38
							thoughts: 17
						

Thoughts:
Okay, here's my summary, taking the perspective of someone deeply familiar with this kind of system:

**Checking the Nomenclature**

Alright, before I dive in, I need to make absolutely certain that the variable or store I'm working with is, in fact, called `comp_algorithm_store`. It's a fundamental step, really. Typos and incorrect naming conventions are the bane of my existence, and they can lead to hours of debugging – completely unnecessary hours, I might add. So, let's just double-check that this is the precise, canonical name we're using. I want to make sure I'm not chasing a phantom reference down the wrong path. No sense in wasting time on a misnamed variable. Let's make sure that's squared away first.



14/2 2026/06/27 07:25 tool grepper
0m Args:
{
  "Expression": "comp_algorithm_store",
  "PathPrefix": "drivers/block/zram/zram_drv.c"
}

Results:
{
  "Output": "drivers/block/zram/zram_drv.c=1660=static void comp_algorithm_set(struct zram *zram, u32 prio, const char *alg)\n--\ndrivers/block/zram/zram_drv.c-1664-\ndrivers/block/zram/zram_drv.c:1665:static int __comp_algorithm_store(struct zram *zram, u32 prio, const char *buf)\ndrivers/block/zram/zram_drv.c-1666-{\n--\ndrivers/block/zram/zram_drv.c=1819=static ssize_t comp_algorithm_show(struct device *dev,\n--\ndrivers/block/zram/zram_drv.c-1830-\ndrivers/block/zram/zram_drv.c:1831:static ssize_t comp_algorithm_store(struct device *dev,\ndrivers/block/zram/zram_drv.c-1832-\t\t\t\t    struct device_attribute *attr,\n--\ndrivers/block/zram/zram_drv.c-1838-\ndrivers/block/zram/zram_drv.c:1839:\tret = __comp_algorithm_store(zram, ZRAM_PRIMARY_COMP, buf);\ndrivers/block/zram/zram_drv.c-1840-\treturn ret ? ret : len;\n--\ndrivers/block/zram/zram_drv.c=1844=static ssize_t recomp_algorithm_show(struct device *dev,\n--\ndrivers/block/zram/zram_drv.c-1862-\ndrivers/block/zram/zram_drv.c:1863:static ssize_t recomp_algorithm_store(struct device *dev,\ndrivers/block/zram/zram_drv.c-1864-\t\t\t\t      struct device_attribute *attr,\n--\ndrivers/block/zram/zram_drv.c-1899-\ndrivers/block/zram/zram_drv.c:1900:\tret = __comp_algorithm_store(zram, prio, alg);\ndrivers/block/zram/zram_drv.c-1901-\treturn ret ? ret : len;\n"
}

15/2 2026/06/27 07:25 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 10760
							output: 37
							thoughts: 21
						

Thoughts:
Here's a summary of my thought process:

**Diving into Zsh Completion Functions**

Okay, time to get my hands dirty. I need to understand how this completion system is behaving, so let's start with a deep dive into the code. The first place to look is definitely the functions `zcomp_get_caps` and `zcomp_validate_level`. These are fundamental. They are probably responsible for determining the capabilities of the completion system and ensuring that the completion level is appropriate given the context, respectively. I'll need to understand what inputs these functions take, what they return, and how they interact. Are they tightly coupled, or independent modules? Are there any obvious potential bottlenecks or edge cases I should watch for in their implementation? Let's trace their execution with different scenarios and see what the results are.



16/2 2026/06/27 07:25 tool grepper
0m Args:
{
  "Expression": "zcomp_validate_level",
  "PathPrefix": "drivers/block/zram/zcomp.c"
}

Results:
{
  "Output": "drivers/block/zram/zcomp.c=100=unsigned int zcomp_get_caps(const char *comp)\n--\ndrivers/block/zram/zcomp.c-106-\ndrivers/block/zram/zcomp.c:107:int zcomp_validate_level(const char *comp, s32 level)\ndrivers/block/zram/zcomp.c-108-{\n"
}

17/2 2026/06/27 07:25 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 11106
							output: 39
							thoughts: 44
						

Thoughts:
Okay, let's see, what configurations are absolutely essential here? The primary one that jumps out at me is, of course, `ZRAM`. That's the core. Now, I need to consider a potential wrinkle. We're dealing with `recomp_algorithm_store`, which gives me pause. I should check if we also need `ZRAM_MULTI_COMP` as part of that configuration. Let me verify.



18/2 2026/06/27 07:25 tool grepper
0m Args:
{
  "Expression": "recomp_algorithm_store",
  "PathPrefix": "drivers/block/zram/zram_drv.c"
}

Results:
{
  "Output": "drivers/block/zram/zram_drv.c=1844=static ssize_t recomp_algorithm_show(struct device *dev,\n--\ndrivers/block/zram/zram_drv.c-1862-\ndrivers/block/zram/zram_drv.c:1863:static ssize_t recomp_algorithm_store(struct device *dev,\ndrivers/block/zram/zram_drv.c-1864-\t\t\t\t      struct device_attribute *attr,\n"
}

19/2 2026/06/27 07:25 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 11413
							output: 35
							thoughts: 25
						

Thoughts:
Here's a summary of my thought process, tailored for an expert like you:

**Checking for ZRAM Multi-Compression Support**

Okay, so I need to verify something about the zram compression setup. My initial step is to determine if the `recomp_algorithm_store` functionality is conditionally compiled. I'm focusing on whether it's enabled under the `CONFIG_ZRAM_MULTI_COMP` configuration option. This is a common pattern, and a critical initial check. I'm essentially tracing the dependencies. Knowing that `recomp_algorithm_store` depends on `CONFIG_ZRAM_MULTI_COMP` will fundamentally impact how I approach the rest of the analysis, so it needs to be established early.



20/2 2026/06/27 07:25 tool grepper
0m Args:
{
  "Expression": "CONFIG_ZRAM_MULTI_COMP",
  "PathPrefix": "drivers/block/zram/"
}

Results:
{
  "Output": "drivers/block/zram/zram_drv.c=227=static inline bool is_partial_io(struct bio_vec *bvec)\n--\ndrivers/block/zram/zram_drv.c-232-\ndrivers/block/zram/zram_drv.c:233:#if defined CONFIG_ZRAM_WRITEBACK || defined CONFIG_ZRAM_MULTI_COMP\ndrivers/block/zram/zram_drv.c-234-struct zram_pp_slot {\n--\ndrivers/block/zram/zram_drv.c=1831=static ssize_t comp_algorithm_store(struct device *dev,\n--\ndrivers/block/zram/zram_drv.c-1842-\ndrivers/block/zram/zram_drv.c:1843:#ifdef CONFIG_ZRAM_MULTI_COMP\ndrivers/block/zram/zram_drv.c-1844-static ssize_t recomp_algorithm_show(struct device *dev,\n--\ndrivers/block/zram/zram_drv.c=2372=static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec,\n--\ndrivers/block/zram/zram_drv.c-2379-\ndrivers/block/zram/zram_drv.c:2380:#ifdef CONFIG_ZRAM_MULTI_COMP\ndrivers/block/zram/zram_drv.c-2381-#define RECOMPRESS_IDLE\t\t(1 \u003c\u003c 0)\n--\ndrivers/block/zram/zram_drv.c=3004=static DEVICE_ATTR_RW(compressed_writeback);\ndrivers/block/zram/zram_drv.c-3005-#endif\ndrivers/block/zram/zram_drv.c:3006:#ifdef CONFIG_ZRAM_MULTI_COMP\ndrivers/block/zram/zram_drv.c-3007-static DEVICE_ATTR_RW(recomp_algorithm);\n--\ndrivers/block/zram/zram_drv.c=3012=static struct attribute *zram_disk_attrs[] = {\n--\ndrivers/block/zram/zram_drv.c-3032-\t\u0026dev_attr_debug_stat.attr,\ndrivers/block/zram/zram_drv.c:3033:#ifdef CONFIG_ZRAM_MULTI_COMP\ndrivers/block/zram/zram_drv.c-3034-\t\u0026dev_attr_recomp_algorithm.attr,\n--\ndrivers/block/zram/zram_drv.h=80=struct zram_stats {\n--\ndrivers/block/zram/zram_drv.h-97-\ndrivers/block/zram/zram_drv.h:98:#ifdef CONFIG_ZRAM_MULTI_COMP\ndrivers/block/zram/zram_drv.h-99-#define ZRAM_PRIMARY_COMP\t0U\n"
}

21/2 2026/06/27 07:25 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 12363
							output: 38
							thoughts: 306
						

Thoughts:
**ZRAM Configuration Considerations**

Alright, so `CONFIG_ZRAM_MULTI_COMP` seems like a no-brainer to enable.  That's a definite positive. Now, the real question is about the compression backends. I see the patch touches `backend_842.c`, `backend_deflate.c`, `backend_lz4.c`, `backend_lz4hc.c`, `backend_lzo.c`, `backend_lzorle.c`, and `backend_zstd.c`.  That means we should probably enable all of the relevant backend options:  `ZRAM_BACKEND_LZ4`, `ZRAM_BACKEND_LZ4HC`, `ZRAM_BACKEND_ZSTD`, `ZRAM_BACKEND_DEFLATE`, `ZRAM_BACKEND_842`, and `ZRAM_BACKEND_LZO`.

Hold on... I need to double-check something.  Right, `ZRAM_BACKEND_LZO` is enabled by default unless `!ZRAM_BACKEND_FORCE_LZO`. Okay, so let's just make sure we're including `ZRAM` and `ZRAM_MULTI_COMP`.

Actually, wait, thinking about it. enabling all the backend options such as `ZRAM_BACKEND_LZ4`, `ZRAM_BACKEND_LZ4HC`, `ZRAM_BACKEND_ZSTD`, `ZRAM_BACKEND_DEFLATE`, `ZRAM_BACKEND_842`, and `ZRAM_BACKEND_LZO` will be useful for testing and evaluating the performance of each backend in a multi-compression setting.  We definitely need to list them all out.

Now, let me make sure I understand the `algorithm_params_store` function in `zram_drv.c`.



22/2 2026/06/27 07:26 tool grepper
0m Args:
{
  "Expression": "algorithm_params_store",
  "PathPrefix": "drivers/block/zram/zram_drv.c"
}

Results:
{
  "Output": "drivers/block/zram/zram_drv.c=1700=static int comp_params_store(struct zram *zram, u32 prio, s32 level,\n--\ndrivers/block/zram/zram_drv.c-1726-\ndrivers/block/zram/zram_drv.c:1727:static ssize_t algorithm_params_store(struct device *dev,\ndrivers/block/zram/zram_drv.c-1728-\t\t\t\t      struct device_attribute *attr,\n"
}

23/2 2026/06/27 07:26 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 13250
							output: 36
							thoughts: 18
						

Thoughts:
Okay, let's see. My first thought is: **Sysfs Export Check**. I need to verify if this `algorithm_params_store` component has been properly exposed through sysfs. That's the crucial first step. If it's not exported there, then my interaction with it is immediately going to be limited. I need to confirm its availability via sysfs before I can do anything further; that is, before I can read from, write to, or otherwise interact with its exposed parameters. I'll need to know whether or not I'm even *allowed* to use it.



24/2 2026/06/27 07:26 tool grepper
0m Args:
{
  "Expression": "algorithm_params",
  "PathPrefix": "drivers/block/zram/zram_drv.c"
}

Results:
{
  "Output": "drivers/block/zram/zram_drv.c=1700=static int comp_params_store(struct zram *zram, u32 prio, s32 level,\n--\ndrivers/block/zram/zram_drv.c-1726-\ndrivers/block/zram/zram_drv.c:1727:static ssize_t algorithm_params_store(struct device *dev,\ndrivers/block/zram/zram_drv.c-1728-\t\t\t\t      struct device_attribute *attr,\n--\ndrivers/block/zram/zram_drv.c=3008=static DEVICE_ATTR_WO(recompress);\ndrivers/block/zram/zram_drv.c-3009-#endif\ndrivers/block/zram/zram_drv.c:3010:static DEVICE_ATTR_WO(algorithm_params);\ndrivers/block/zram/zram_drv.c-3011-\ndrivers/block/zram/zram_drv.c=3012=static struct attribute *zram_disk_attrs[] = {\n--\ndrivers/block/zram/zram_drv.c-3036-#endif\ndrivers/block/zram/zram_drv.c:3037:\t\u0026dev_attr_algorithm_params.attr,\ndrivers/block/zram/zram_drv.c-3038-\tNULL,\n"
}

25/2 2026/06/27 07:26 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 13788
							output: 38
							thoughts: 261
						

Thoughts:
**My Analysis of the ZRAM Algorithm Parameter Implementation**

Okay, so I'm digging into this `algorithm_params` attribute within the sysfs. My initial thought is to confirm its usage. Let's see... I'm noticing `comp_params_store` is being called directly from `algorithm_params_store`, which makes sense. I also see that `__comp_algorithm_store` is being called from both `comp_algorithm_store` and `recomp_algorithm_store`. That's important to keep in mind, knowing the calling chains and dependencies. So far, the call flow is logical, at least on the surface.

From this quick overview, it looks like the patch is functional and definitely reachable based on the connections I can see. Now, to really dive in, I need to focus my attention on these key symbols: `algorithm_params_store`, `comp_params_store`, `__comp_algorithm_store`, `zcomp_get_caps`, and `zcomp_validate_level`. That gives me a good starting point to follow the control flow and understand the guts of this implementation.

Then, there are the kernel configurations related to ZRAM: `ZRAM`, `ZRAM_MULTI_COMP`, `ZRAM_BACKEND_LZ4`, `ZRAM_BACKEND_LZ4HC`, `ZRAM_BACKEND_ZSTD`, `ZRAM_BACKEND_DEFLATE`, `ZRAM_BACKEND_842` and `ZRAM_BACKEND_LZO`. I need to understand how these impact the overall behavior. Wait, hang on... `ZRAM_BACKEND_LZO` is a boolean. Let's make sure that that is correct by cross-checking `drivers/block/zram/Kconfig` to confirm that the type is set correctly in the Kconfig.



26/2 2026/06/27 07:26 tool grepper
0m Args:
{
  "Expression": "config ZRAM_BACKEND_LZO",
  "PathPrefix": "drivers/block/zram/Kconfig"
}

Results:
{
  "Output": "drivers/block/zram/Kconfig=47=config ZRAM_BACKEND_FORCE_LZO\n--\ndrivers/block/zram/Kconfig-52-\ndrivers/block/zram/Kconfig:53:config ZRAM_BACKEND_LZO\ndrivers/block/zram/Kconfig-54-\tbool \"lzo and lzo-rle compression support\" if !ZRAM_BACKEND_FORCE_LZO\n"
}

27/2 2026/06/27 07:26 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 14598
							output: 37
							thoughts: 103
						

Thoughts:
**Analyzing the Zstandard Codebase**

Okay, so the initial flag I'm looking at, that's a boolean, no surprises there. My primary concern right now is identifying the full extent of the changes related to the zstd library. I know there's a modification, but I need to ensure I haven't missed anything else.

I recall a specific change to `zstd_create` within `backend_zstd.c`. The removal of `zstd_release_params(params)` in that particular function is something to keep in mind. I need to be thorough. Now, given that `zstd_create` is declared as static, it's not directly exposed externally. It is likely called through `zcomp_create`. Even so, I think I'll add `zstd_create` to the focus symbols to make certain I capture everything. I'm going to take a closer look at the `zstd_create` function itself to solidify my understanding.



28/2 2026/06/27 07:26 tool grepper
0m Args:
{
  "Expression": "zstd_create",
  "PathPrefix": "drivers/block/zram/backend_zstd.c"
}

Results:
{
  "Output": "drivers/block/zram/backend_zstd.c=51=static int zstd_setup_params(struct zcomp_params *params)\n--\ndrivers/block/zram/backend_zstd.c-71-\ndrivers/block/zram/backend_zstd.c:72:\tzp-\u003ecdict = zstd_create_cdict_byreference(params-\u003edict,\ndrivers/block/zram/backend_zstd.c-73-\t\t\t\t\t\t  params-\u003edict_sz,\n--\ndrivers/block/zram/backend_zstd.c-78-\ndrivers/block/zram/backend_zstd.c:79:\tzp-\u003eddict = zstd_create_ddict_byreference(params-\u003edict,\ndrivers/block/zram/backend_zstd.c-80-\t\t\t\t\t\t  params-\u003edict_sz,\n--\ndrivers/block/zram/backend_zstd.c=92=static void zstd_destroy(struct zcomp_ctx *ctx)\n--\ndrivers/block/zram/backend_zstd.c-118-\ndrivers/block/zram/backend_zstd.c:119:static int zstd_create(struct zcomp_params *params, struct zcomp_ctx *ctx)\ndrivers/block/zram/backend_zstd.c-120-{\n--\ndrivers/block/zram/backend_zstd.c-151-\ndrivers/block/zram/backend_zstd.c:152:\t\tzctx-\u003ecctx = zstd_create_cctx_advanced(zp-\u003ecustom_mem);\ndrivers/block/zram/backend_zstd.c-153-\t\tif (!zctx-\u003ecctx)\n--\ndrivers/block/zram/backend_zstd.c-155-\ndrivers/block/zram/backend_zstd.c:156:\t\tzctx-\u003edctx = zstd_create_dctx_advanced(zp-\u003ecustom_mem);\ndrivers/block/zram/backend_zstd.c-157-\t\tif (!zctx-\u003edctx)\n--\ndrivers/block/zram/backend_zstd.c=208=const struct zcomp_ops backend_zstd = {\n--\ndrivers/block/zram/backend_zstd.c-210-\t.decompress\t= zstd_decompress,\ndrivers/block/zram/backend_zstd.c:211:\t.create_ctx\t= zstd_create,\ndrivers/block/zram/backend_zstd.c-212-\t.destroy_ctx\t= zstd_destroy,\n"
}

29/2 2026/06/27 07:26 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 15591
							output: 241
							thoughts: 267
						

Thoughts:
**Analyzing Compression Parameter Changes in ZRAM**

Alright, let's zero in on `zstd_create`. That feels like the key function here. First, I need to make sure I'm clear on the relevant focus symbols: `algorithm_params_store`, `comp_params_store`, `__comp_algorithm_store`, `zcomp_get_caps`, `zcomp_validate_level`, and the already established `zstd_create`.

Next, I'll quickly refresh my memory on the ZRAM configuration options involved. I see `ZRAM`, `ZRAM_MULTI_COMP`, the backend choices `ZRAM_BACKEND_LZ4`, `ZRAM_BACKEND_LZ4HC`, `ZRAM_BACKEND_ZSTD`, `ZRAM_BACKEND_DEFLATE`, `ZRAM_BACKEND_842`, and `ZRAM_BACKEND_LZO`.

Now, putting it all together, the patch seems to be refining how compression parameters are handled within ZRAM. It's enhancing the compression level capabilities and adding dictionary support, which is a good move. On top of that, I see a fix for a memory leak within `comp_params_store` and a bit of tidying up by removing a redundant parameter release in `zstd_create`. The changes seem to be functionally sound and directly accessible from userspace. I can see this being triggered by sysfs attributes like `algorithm_params`, `comp_algorithm`, and `recomp_algorithm`.

Okay, I think I have a good grasp on this. I should call `set-results` now.



30/2 2026/06/27 07:26 tool set-results
0m Args:
{
  "EnableConfigs": [
    "ZRAM",
    "ZRAM_MULTI_COMP",
    "ZRAM_BACKEND_LZ4",
    "ZRAM_BACKEND_LZ4HC",
    "ZRAM_BACKEND_ZSTD",
    "ZRAM_BACKEND_DEFLATE",
    "ZRAM_BACKEND_842",
    "ZRAM_BACKEND_LZO"
  ],
  "FocusSymbols": [
    "algorithm_params_store",
    "comp_params_store",
    "__comp_algorithm_store",
    "zcomp_get_caps",
    "zcomp_validate_level",
    "zstd_create"
  ],
  "Reasoning": "The patch modifies zram compression parameters handling. It adds capabilities and validation for compression levels and dictionary support. It also fixes a memory leak in `comp_params_store` and removes a redundant parameter release in `zstd_create`. These changes are functional and reachable from userspace via sysfs attributes like `algorithm_params`, `comp_algorithm`, and `recomp_algorithm`.",
  "WorthFuzzing": true
}

Results:
{
  "EnableConfigs": [
    "ZRAM",
    "ZRAM_MULTI_COMP",
    "ZRAM_BACKEND_LZ4",
    "ZRAM_BACKEND_LZ4HC",
    "ZRAM_BACKEND_ZSTD",
    "ZRAM_BACKEND_DEFLATE",
    "ZRAM_BACKEND_842",
    "ZRAM_BACKEND_LZO"
  ],
  "FocusSymbols": [
    "algorithm_params_store",
    "comp_params_store",
    "__comp_algorithm_store",
    "zcomp_get_caps",
    "zcomp_validate_level",
    "zstd_create"
  ],
  "Reasoning": "The patch modifies zram compression parameters handling. It adds capabilities and validation for compression levels and dictionary support. It also fixes a memory leak in `comp_params_store` and removes a redundant parameter release in `zstd_create`. These changes are functional and reachable from userspace via sysfs attributes like `algorithm_params`, `comp_algorithm`, and `recomp_algorithm`.",
  "WorthFuzzing": true
}

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)