tap: Cast ETH_MAX_MTU to signed in comparisons
At least gcc 8.3 and 10.2 emit a warning on armv6l and armv7l. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
601f7ee78e
commit
bd7340e815
1 changed files with 2 additions and 2 deletions
4
tap.c
4
tap.c
|
@ -658,7 +658,7 @@ redo:
|
||||||
/* Complete the partial read above before discarding a malformed
|
/* Complete the partial read above before discarding a malformed
|
||||||
* frame, otherwise the stream will be inconsistent.
|
* frame, otherwise the stream will be inconsistent.
|
||||||
*/
|
*/
|
||||||
if (len < (ssize_t)sizeof(*eh) || len > ETH_MAX_MTU)
|
if (len < (ssize_t)sizeof(*eh) || len > (ssize_t)ETH_MAX_MTU)
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
pcap(p, len);
|
pcap(p, len);
|
||||||
|
@ -718,7 +718,7 @@ restart:
|
||||||
while ((len = read(c->fd_tap, pkt_buf + n, TAP_BUF_BYTES - n)) > 0) {
|
while ((len = read(c->fd_tap, pkt_buf + n, TAP_BUF_BYTES - n)) > 0) {
|
||||||
struct ethhdr *eh = (struct ethhdr *)(pkt_buf + n);
|
struct ethhdr *eh = (struct ethhdr *)(pkt_buf + n);
|
||||||
|
|
||||||
if (len < (ssize_t)sizeof(*eh) || len > ETH_MAX_MTU) {
|
if (len < (ssize_t)sizeof(*eh) || len > (ssize_t)ETH_MAX_MTU) {
|
||||||
n += len;
|
n += len;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue