Commit ce3c8692 authored by Nicolas Kaiser's avatar Nicolas Kaiser Committed by David S. Miller

drivers/net/macvtap: fix error check

'len' is unsigned of type size_t and can't be negative.
Signed-off-by: default avatarNicolas Kaiser <nikai@nikai.net>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b3ca9b02
...@@ -528,8 +528,9 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, ...@@ -528,8 +528,9 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q,
vnet_hdr_len = q->vnet_hdr_sz; vnet_hdr_len = q->vnet_hdr_sz;
err = -EINVAL; err = -EINVAL;
if ((len -= vnet_hdr_len) < 0) if (len < vnet_hdr_len)
goto err; goto err;
len -= vnet_hdr_len;
err = memcpy_fromiovecend((void *)&vnet_hdr, iv, 0, err = memcpy_fromiovecend((void *)&vnet_hdr, iv, 0,
sizeof(vnet_hdr)); sizeof(vnet_hdr));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment