All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Wang Xiaojun <wangxiaojun11@huawei.com>, jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: avoid to create an empty string as the extension_list
Date: Fri, 9 Jul 2021 11:21:24 +0800	[thread overview]
Message-ID: <0b0ae666-e020-2e1d-c893-e8180a7f1225@kernel.org> (raw)
In-Reply-To: <20210709020559.3885430-1-wangxiaojun11@huawei.com>

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 <wangxiaojun11@huawei.com>
> ---
>   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 <chao@kernel.org>

Thanks,

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


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2021-07-09  3:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09  2:05 [f2fs-dev] [PATCH] f2fs: avoid to create an empty string as the extension_list Wang Xiaojun
2021-07-09  3:21 ` Chao Yu [this message]
2021-07-09  3:49   ` wangxiaojun (N)
2021-07-09  4:02     ` Chao Yu
2021-07-09  4:39       ` wangxiaojun (N)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b0ae666-e020-2e1d-c893-e8180a7f1225@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=wangxiaojun11@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.