From: sashiko-bot@kernel.org
To: "Sergey Senozhatsky" <senozhatsky@chromium.org>,
"Andrew Morton" <akpm@linux-foundation.org>
Cc: "Minchan Kim" <minchan@kernel.org>,
linux-mm@kvack.org, "Alejandro Colomar" <alx@kernel.org>
Subject: Re: [PATCH] zram: do not modify cont sysfs store buffers
Date: Fri, 27 Nov 2026 01:59:57 +0000 [thread overview]
Message-ID: <sashiko-outbox-236427@kernel.org> (raw)
In-Reply-To: <20261126014518.1318583-1-senozhatsky@chromium.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] zram: separate declaration and initialization of __free(kfree)
kbuf
--
commit be297424ad592ae67e98644a43d786e259a7383b
Author: Sergey Senozhatsky <senozhatsky@chromium.org>
zram: do not modify cont sysfs store buffers
This commit duplicates the const input buffer with kstrndup() in zram sysfs
store handlers before tokenizing key=value arguments in-place with
next_arg().
Link: https://lore.kernel.org/all/awcpkJD6K1xtx_Pe@devuan/
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index d969f17b55afe..ff9e53f001bc2 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -1285,10 +1285,15 @@ static ssize_t writeback_store(struct device *dev,
> unsigned long lo = 0, hi;
> struct zram_pp_ctl *pp_ctl = NULL;
> struct zram_wb_ctl *wb_ctl = NULL;
> + char *kbuf __free(kfree) = NULL;
> char *args, *param, *val;
> ssize_t ret = len;
> int err, mode = 0;
>
> + kbuf = kstrndup(buf, len, GFP_KERNEL);
> + if (!kbuf)
> + return -ENOMEM;
[Severity: Low]
This isn't a bug, but include/linux/cleanup.h recommends defining and
initializing __free() variables in a single statement rather than declaring
them "= NULL" at the top of the function and assigning them later. In
writeback_store(), algorithm_params_store(), recomp_algorithm_store() and
recompress_store(), kbuf can be defined directly at the kstrndup() call:
char *kbuf __free(kfree) = kstrndup(buf, len, GFP_KERNEL);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126014518.1318583-1-senozhatsky@chromium.org?part=1
next prev parent reply other threads:[~2026-11-27 2:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 1:45 [PATCH] zram: do not modify cont sysfs store buffers Sergey Senozhatsky
2026-11-26 6:34 ` + zram-do-not-modify-cont-sysfs-store-buffers.patch added to mm-new branch Andrew Morton
2026-11-26 11:24 ` [PATCH] zram: do not modify cont sysfs store buffers Alejandro Colomar
2026-11-27 1:59 ` sashiko-bot [this message]
2026-11-27 2:06 ` 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=sashiko-outbox-236427@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alx@kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=senozhatsky@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.