When creating a file, we need to set the temperature based on
extension_list. If the empty string is a valid extension_list,
the is_extension_exist will always returns true,
which affects the separation of hot and cold.

Signed-off-by: Wang Xiaojun <[email protected]>
---
v1->v2:let the caller do the check on @name
---
 fs/f2fs/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 39b522ec73e7..fc54e280b5a0 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -337,7 +337,7 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
                        set = false;
                }
 
-               if (strlen(name) >= F2FS_EXTENSION_LEN)
+               if (!strlen(name) || strlen(name) >= F2FS_EXTENSION_LEN)
                        return -EINVAL;
 
                down_write(&sbi->sb_lock);
-- 
2.25.4



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to