[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250310161758.606151-1-sj@kernel.org>
Date: Mon, 10 Mar 2025 09:17:58 -0700
From: SeongJae Park <sj@...nel.org>
To: Arnd Bergmann <arnd@...nel.org>
Cc: SeongJae Park <sj@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Arnd Bergmann <arnd@...db.de>,
Hyeongtak Ji <hyeongtak.ji@...com>,
Honggyu Kim <honggyu.kim@...com>,
Usama Arif <usamaarif642@...il.com>,
damon@...ts.linux.dev,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/damon/sysfs-schemes: avoid Wformat-security warning
On Mon, 10 Mar 2025 14:51:37 +0100 Arnd Bergmann <arnd@...nel.org> wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> This warning is for potentially user-defined format strings:
>
> mm/damon/sysfs-schemes.c:1664:4: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
> 1664 | name);
>
> Change this to use "%s" as the format and the name as the argument.
Thank you for this patch!
>
> Fixes: 92bc039dd72e ("mm/damon/sysfs-schemes: let damon_sysfs_scheme_set_filters() be used for different named directories")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
Reviewed-by: SeongJae Park <sj@...nel.org>
Thanks,
SJ
> ---
> mm/damon/sysfs-schemes.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
> index 50e6907515e6..23ac98dd6451 100644
> --- a/mm/damon/sysfs-schemes.c
> +++ b/mm/damon/sysfs-schemes.c
> @@ -1661,7 +1661,7 @@ static int damon_sysfs_scheme_set_filters(struct damon_sysfs_scheme *scheme,
> return -ENOMEM;
> err = kobject_init_and_add(&filters->kobj,
> &damon_sysfs_scheme_filters_ktype, &scheme->kobj,
> - name);
> + "%s", name);
> if (err)
> kobject_put(&filters->kobj);
> else
> --
> 2.39.5
Powered by blists - more mailing lists