From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Andrew Stellman <astellman@stellman-greene.com>
Cc: Minchan Kim <minchan@kernel.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] zram: reject unrecognized type= values in recompress_store()
Date: Tue, 7 Apr 2026 23:18:31 +0900 [thread overview]
Message-ID: <adUSEQXaWJAobTpv@google.com> (raw)
In-Reply-To: <20260407123836.6341-4-astellman@stellman-greene.com>
On (26/04/07 08:38), Andrew Stellman wrote:
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 8ea2a12..67dea80 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -2555,10 +2555,12 @@ static ssize_t recompress_store(struct device *dev,
> if (!strcmp(param, "type")) {
> if (!strcmp(val, "idle"))
> mode = RECOMPRESS_IDLE;
> - if (!strcmp(val, "huge"))
> + else if (!strcmp(val, "huge"))
> mode = RECOMPRESS_HUGE;
> - if (!strcmp(val, "huge_idle"))
> + else if (!strcmp(val, "huge_idle"))
> mode = RECOMPRESS_IDLE | RECOMPRESS_HUGE;
> + else
> + return -EINVAL;
> continue;
> }
Let's do it like this:
---
@@ -2552,6 +2552,9 @@ static ssize_t recompress_store(struct device *dev,
mode = RECOMPRESS_HUGE;
if (!strcmp(val, "huge_idle"))
mode = RECOMPRESS_IDLE | RECOMPRESS_HUGE;
+
+ if (!mode)
+ return -EINVAL;
continue;
}
next prev parent reply other threads:[~2026-04-07 14:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 12:38 [PATCH 0/4] zram: fix four error-handling and input-validation bugs Andrew Stellman
2026-04-07 12:38 ` [PATCH 1/4] zram: complete parent bio on allocation failure in read_from_bdev_async() Andrew Stellman
2026-04-07 14:15 ` Sergey Senozhatsky
2026-04-07 12:38 ` [PATCH 2/4] zram: call bio_endio() on early return in zram_bio_discard() Andrew Stellman
2026-04-07 14:14 ` Sergey Senozhatsky
2026-04-07 12:38 ` [PATCH 3/4] zram: reject unrecognized type= values in recompress_store() Andrew Stellman
2026-04-07 14:18 ` Sergey Senozhatsky [this message]
2026-04-07 12:38 ` [PATCH 4/4] zram: add init_done() guard to algorithm_params_store() Andrew Stellman
2026-04-07 14:14 ` Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=adUSEQXaWJAobTpv@google.com \
--to=senozhatsky@chromium.org \
--cc=astellman@stellman-greene.com \
--cc=linux-kernel@vger.kernel.org \
--cc=minchan@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox