Skip to contentSkip to conversation

f2fs: avoid to create an empty string as the extension_list

PATCH In review Wang Xiaojun 2 participants 2 messages Jul 9, 2021 – Jul 10, 2021 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 f2fs: avoid to create an empty string as the extension_list

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.

---
v1->v2:let the caller do the check on @name

---
 fs/f2fs/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/sysfs.c +1 -1
index 39b522ec73e7..fc54e280b5a0 100644
@@ -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);
Signature · 8 lines
2.25.4



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Wang Xiaojun

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.

Thanks,

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