mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-22 14:13:04 +00:00
btrfs-progs: Fix -Wtype-limits warning
The only hit is the following code: tlv_len = le16_to_cpu(tlv_hdr->tlv_len); if (tlv_type == 0 || tlv_type > BTRFS_SEND_A_MAX || tlv_len > BTRFS_SEND_BUF_SIZE) { error("invalid tlv in cmd tlv_type = %hu, tlv_len = %hu", tlv_type, tlv_len); @tlv_len is u16, while BTRFS_SEND_BUF_SIZE is 64K. u16 MAX is 64K - 1, so the final check is always false. Just remove it. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
278c64b208
commit
e27e36b989
@ -157,8 +157,7 @@ static int read_cmd(struct btrfs_send_stream *sctx)
|
|||||||
tlv_type = le16_to_cpu(tlv_hdr->tlv_type);
|
tlv_type = le16_to_cpu(tlv_hdr->tlv_type);
|
||||||
tlv_len = le16_to_cpu(tlv_hdr->tlv_len);
|
tlv_len = le16_to_cpu(tlv_hdr->tlv_len);
|
||||||
|
|
||||||
if (tlv_type == 0 || tlv_type > BTRFS_SEND_A_MAX
|
if (tlv_type == 0 || tlv_type > BTRFS_SEND_A_MAX) {
|
||||||
|| tlv_len > BTRFS_SEND_BUF_SIZE) {
|
|
||||||
error("invalid tlv in cmd tlv_type = %hu, tlv_len = %hu",
|
error("invalid tlv in cmd tlv_type = %hu, tlv_len = %hu",
|
||||||
tlv_type, tlv_len);
|
tlv_type, tlv_len);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
Loading…
Reference in New Issue
Block a user