f2fs: fix to check upper boundary for value of gc_boost_zoned_gc_percent
authoryohan.joung <yohan.joung@sk.com>
Wed, 25 Jun 2025 00:14:07 +0000 (09:14 +0900)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 30 Jun 2025 16:43:58 +0000 (16:43 +0000)
to check the upper boundary when setting gc_boost_zoned_gc_percent

Fixes: 9a481a1c16f4 ("f2fs: create gc_no_zoned_gc_percent and gc_boost_zoned_gc_percent")
Signed-off-by: yohan.joung <yohan.joung@sk.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/sysfs.c

index 51be7ffb38c5dabe3608cb8884e4a547357de307..2b5c35ce7b8c7aab4198a06c5ae2663aeb117ce2 100644 (file)
@@ -628,6 +628,13 @@ out:
                return count;
        }
 
+       if (!strcmp(a->attr.name, "gc_boost_zoned_gc_percent")) {
+               if (t > 100)
+                       return -EINVAL;
+               *ui = (unsigned int)t;
+               return count;
+       }
+
 #ifdef CONFIG_F2FS_IOSTAT
        if (!strcmp(a->attr.name, "iostat_enable")) {
                sbi->iostat_enable = !!t;