mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-18 20:04:16 +08:00
drivers/net/macvtap: fix error check
'len' is unsigned of type size_t and can't be negative. Signed-off-by: Nicolas Kaiser <nikai@nikai.net> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b3ca9b02b0
commit
ce3c869283
@ -528,8 +528,9 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q,
|
||||
vnet_hdr_len = q->vnet_hdr_sz;
|
||||
|
||||
err = -EINVAL;
|
||||
if ((len -= vnet_hdr_len) < 0)
|
||||
if (len < vnet_hdr_len)
|
||||
goto err;
|
||||
len -= vnet_hdr_len;
|
||||
|
||||
err = memcpy_fromiovecend((void *)&vnet_hdr, iv, 0,
|
||||
sizeof(vnet_hdr));
|
||||
|
Loading…
Reference in New Issue
Block a user