On 2021/7/9 10:05, Wang Xiaojun wrote:
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]>
---
  fs/f2fs/namei.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index a9cd9cf97229..34341d3edb8d 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -219,6 +219,8 @@ int f2fs_update_extension_list(struct f2fs_sb_info *sbi, 
const char *name,
        int start, count;
        int i;
+ if (!strlen(name))
+               return -EINVAL;

How about adding this in __sbi_store()? like:

if (!strlen(name) || strlen(name) >= F2FS_EXTENSION_LEN)
        return -EINVAL;

Otherwise, it looks good to me.

Reviewed-by: Chao Yu <[email protected]>

Thanks,

        if (set) {
                if (total_count == F2FS_MAX_EXTENSION)
                        return -EINVAL;



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

Reply via email to