Skip to content
Snippets Groups Projects
Commit 5bdcb374 authored by Qu Wenruo's avatar Qu Wenruo Committed by Tom Rini
Browse files

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: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarMarek Behún <marek.behun@nic.cz>
parent 92bc179c
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment