提交 5bdcb374 编写于 作者: Q Qu Wenruo 提交者: Tom Rini

fs: btrfs: inode: Allow next_length() to return value > BTRFS_NAME_LEN

All existing next_length() caller handles return value > BTRFS_NAME_LEN,
so there is no need to do BTRFS_NAME_LEN check in next_length().

But still, we want to exit early if we're beyond BTRFS_NAME_LEN, so this
patch makes next_length() exit as soon as we're beyond BTRFS_NAME_LEN.
Signed-off-by: NQu Wenruo <wqu@suse.com>
Reviewed-by: NMarek Behún <marek.behun@nic.cz>
上级 92bc179c
......@@ -217,8 +217,12 @@ static u64 __get_parent_inode(struct __btrfs_root *root, u64 inr,
static inline int next_length(const char *path)
{
int res = 0;
while (*path != '\0' && *path != '/' && res <= BTRFS_NAME_LEN)
++res, ++path;
while (*path != '\0' && *path != '/') {
++res;
++path;
if (res > BTRFS_NAME_LEN)
break;
}
return res;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册