Skip to content

Commit

Permalink
drivers/net/macvtap: fix error check
Browse files Browse the repository at this point in the history
'len' is unsigned of type size_t and can't be negative.

Signed-off-by: Nicolas Kaiser <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
nikai3d authored and davem330 committed Mar 7, 2011
1 parent b3ca9b0 commit ce3c869
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/macvtap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit ce3c869

Please sign in to comment.