aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2017-07-26 23:42:12 -0300
committerMichael Tokarev <mjt@tls.msk.ru>2017-07-31 13:06:38 +0300
commitb2caa3b82edca29ccb5e7d6311ffcf841b9b7786 (patch)
tree588e785a412659094bba0a42db253fdb16c9162e
parent9f26f3252534e7680cfc7c0dbd1d79fdb56519ad (diff)
downloadqemu-b2caa3b82edca29ccb5e7d6311ffcf841b9b7786.zip
qemu-b2caa3b82edca29ccb5e7d6311ffcf841b9b7786.tar.gz
qemu-b2caa3b82edca29ccb5e7d6311ffcf841b9b7786.tar.bz2
net/eth: fix incorrect check of iov_to_buf() return value
So we have sizeof(struct in6_address) != sizeof(uintptr_t) and Clang > Coverity on this, see 4555ca6816c :) net/eth.c:426:30: warning: The code calls sizeof() on a pointer type. This can produce an unexpected result return bytes_read == sizeof(dst_addr); ^ ~~~~~~~~~~ net/eth.c:475:34: warning: The code calls sizeof() on a pointer type. This can produce an unexpected result return bytes_read == sizeof(src_addr); ^ ~~~~~~~~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Dmitry Fleytman <dmitry@daynix.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--net/eth.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/eth.c b/net/eth.c
index 5b9ba26..ae5d881 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -423,7 +423,7 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags,
rthdr_offset + sizeof(*ext_hdr),
dst_addr, sizeof(*dst_addr));
- return bytes_read == sizeof(dst_addr);
+ return bytes_read == sizeof(*dst_addr);
}
return false;
@@ -472,7 +472,7 @@ _eth_get_rss_ex_src_addr(const struct iovec *pkt, int pkt_frags,
opt_offset + sizeof(opthdr),
src_addr, sizeof(*src_addr));
- return bytes_read == sizeof(src_addr);
+ return bytes_read == sizeof(*src_addr);
}
opt_offset += optlen;