[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for 2.10 10/35] net/eth: fix incorrect check of
From: |
Dmitry Fleytman |
Subject: |
Re: [Qemu-devel] [PATCH for 2.10 10/35] net/eth: fix incorrect check of iov_to_buf() return value |
Date: |
Wed, 26 Jul 2017 12:51:06 +0300 |
> On 24 Jul 2017, at 21:27 PM, Philippe Mathieu-Daudé <address@hidden> wrote:
>
> 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>
> ---
> 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);
> }
>
Reviewed-by: Dmitry Fleytman <address@hidden>
> opt_offset += optlen;
> --
> 2.13.3
>
- Re: [Qemu-devel] [PATCH for 2.10 06/35] qcow2: remove inconsistent check, (continued)
- [Qemu-devel] [PATCH for 2.10 07/35] qcow2: fix null pointer dereference, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 08/35] qcow2: fix null pointer dereference, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 09/35] ui/vnc: fix leak of SocketAddress **, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 10/35] net/eth: fix incorrect check of iov_to_buf() return value, Philippe Mathieu-Daudé, 2017/07/24
- Re: [Qemu-devel] [PATCH for 2.10 10/35] net/eth: fix incorrect check of iov_to_buf() return value,
Dmitry Fleytman <=
- [Qemu-devel] [PATCH for 2.10 11/35] i2c/exynos4210: correctly check i2c_recv() return value, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 12/35] vfio/platform: fix use of freed memory, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 13/35] vfio/pci: fix use of freed memory, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 15/35] usb: correctly handle Zero Length Packets, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 14/35] vfio/ccw: fix incorrect malloc() size, Philippe Mathieu-Daudé, 2017/07/24