[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PATCH for 2.10 v2 07/20] net/eth: fix incorrect check of
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-trivial] [PATCH for 2.10 v2 07/20] net/eth: fix incorrect check of iov_to_buf() return value |
Date: |
Wed, 26 Jul 2017 23:42:12 -0300 |
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é <address@hidden>
Reviewed-by: Dmitry Fleytman <address@hidden>
---
net/eth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/eth.c b/net/eth.c
index 5b9ba26a56..ae5d881aae 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;
--
2.13.3
- [Qemu-trivial] [PATCH for 2.10 v2 00/20] fix bugs reported by Clang Static Analyzer, Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 01/20] tests: add missing dependency to build QTEST_QEMU_BINARY, Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 02/20] loader: check get_image_size() return value, Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 03/20] ivshmem: fix incorrect error handling in ivshmem_recv_msg(), Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 05/20] qcow2: fix null pointer dereference, Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 04/20] nbd: fix memory leak in nbd_opt_go(), Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 06/20] ui/vnc: fix leak of SocketAddress **, Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 08/20] vfio/platform: fix use of freed memory, Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 07/20] net/eth: fix incorrect check of iov_to_buf() return value,
Philippe Mathieu-Daudé <=
- [Qemu-trivial] [PATCH for 2.10 v2 09/20] vfio/pci: fix use of freed memory, Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 10/20] m68k/translate: fix incorrect copy/paste, Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 11/20] linux-user/sh4: fix incorrect memory write, Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 12/20] syscall: fix dereference of undefined pointer, Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 13/20] syscall: fix use of uninitialized values, Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 14/20] syscall: check inotify() and eventfd() return value, Philippe Mathieu-Daudé, 2017/07/26
- [Qemu-trivial] [PATCH for 2.10 v2 15/20] thunk: assert nb_fields is valid, Philippe Mathieu-Daudé, 2017/07/26