]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
f2fs: fix to check upper boundary for gc_no_zoned_gc_percent
authorChao Yu <chao@kernel.org>
Fri, 27 Jun 2025 02:38:18 +0000 (10:38 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 30 Jun 2025 16:44:52 +0000 (16:44 +0000)
This patch adds missing upper boundary check while setting
gc_no_zoned_gc_percent via sysfs.

Fixes: 9a481a1c16f4 ("f2fs: create gc_no_zoned_gc_percent and gc_boost_zoned_gc_percent")
Cc: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/sysfs.c

index d74472d96026a70fb38cbf17d10fe61d6f8846da..bdef926b33771ccf8a47cc000f7e4f4b5527438e 100644 (file)
@@ -628,6 +628,13 @@ out:
                return count;
        }
 
+       if (!strcmp(a->attr.name, "gc_no_zoned_gc_percent")) {
+               if (t > 100)
+                       return -EINVAL;
+               *ui = (unsigned int)t;
+               return count;
+       }
+
        if (!strcmp(a->attr.name, "gc_boost_zoned_gc_percent")) {
                if (t > 100)
                        return -EINVAL;