btrfs: Introduce btrfs_is_name_len_valid to avoid reading beyond boundary
authorSu Yue <suy.fnst@cn.fujitsu.com>
Tue, 6 Jun 2017 09:57:00 +0000 (17:57 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 21 Jun 2017 17:16:04 +0000 (19:16 +0200)
commit19c6dcbfa74674ac5ab5d18096ee813f858668c3
treefc86826db4b41589e939aa3a4dff56be67056273
parent66b4993e95c17e0ee30f0d72f0d6e00e5c035a98
btrfs: Introduce btrfs_is_name_len_valid to avoid reading beyond boundary

Introduce function btrfs_is_name_len_valid.

The function compares parameter @name_len with item boundary then
returns true if name_len is valid.

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ s/btrfs_leaf_data/BTRFS_LEAF_DATA_OFFSET/ ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/dir-item.c