Skip to content

Commit 4f97737

Browse files
author
Audra Mitchell
committed
mm/damon/sysfs-schemes: avoid Wformat-security warning on damon_sysfs_access_pattern_add_range_dir()
JIRA: https://issues.redhat.com/browse/RHEL-104908 This patch is a backport of the following upstream commit: commit c637c61 Author: SeongJae Park <[email protected]> Date: Mon Mar 10 09:50:09 2025 -0700 mm/damon/sysfs-schemes: avoid Wformat-security warning on damon_sysfs_access_pattern_add_range_dir() When -Wformat-security is given, compiler warns as a potential security issue on damon_sysfs_access_pattern_add_range_dir() as below: mm/damon/sysfs-schemes.c: In function `damon_sysfs_access_pattern_add_range_dir': mm/damon/sysfs-schemes.c:1503:25: warning: format not a string literal and no format arguments [-Wformat-security] 1503 | &access_pattern->kobj, name); | ^ Fix it by using "%s" as the format and the name as the argument. Link: https://lkml.kernel.org/r/[email protected] Fixes: 7e84b1f ("mm/damon/sysfs: support DAMON-based Operation Schemes") Signed-off-by: SeongJae Park <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Audra Mitchell <[email protected]>
1 parent f357e5a commit 4f97737

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/damon/sysfs-schemes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ static int damon_sysfs_access_pattern_add_range_dir(
10511051
if (!range)
10521052
return -ENOMEM;
10531053
err = kobject_init_and_add(&range->kobj, &damon_sysfs_ul_range_ktype,
1054-
&access_pattern->kobj, name);
1054+
&access_pattern->kobj, "%s", name);
10551055
if (err)
10561056
kobject_put(&range->kobj);
10571057
else

0 commit comments

Comments
 (0)