lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d417f6f76c3d4326901410b72872765b@AMSPEX02CL03.citrite.net>
Date:   Thu, 13 Oct 2016 01:22:12 +0000
From:   Paul Durrant <Paul.Durrant@...rix.com>
To:     Arnd Bergmann <arnd@...db.de>, Wei Liu <wei.liu2@...rix.com>
CC:     "David S. Miller" <davem@...emloft.net>,
        David Vrabel <david.vrabel@...rix.com>,
        "xen-devel@...ts.xenproject.org" <xen-devel@...ts.xenproject.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] xen-netback: fix type mismatch warning

> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@...db.de]
> Sent: 12 October 2016 10:54
> To: Wei Liu <wei.liu2@...rix.com>; Paul Durrant <Paul.Durrant@...rix.com>
> Cc: Arnd Bergmann <arnd@...db.de>; David S. Miller
> <davem@...emloft.net>; David Vrabel <david.vrabel@...rix.com>; xen-
> devel@...ts.xenproject.org; netdev@...r.kernel.org; linux-
> kernel@...r.kernel.org
> Subject: [PATCH] xen-netback: fix type mismatch warning
> 
> Wiht the latest rework of the xen-netback driver, we get a warning
> on ARM about the types passed into min():
> 
> drivers/net/xen-netback/rx.c: In function 'xenvif_rx_next_chunk':
> include/linux/kernel.h:739:16: error: comparison of distinct pointer types
> lacks a cast [-Werror]
> 
> The reason is that XEN_PAGE_SIZE is not size_t here. There
> is no actual bug, and we can easily avoid the warning using the
> min_t() macro instead of min().
> 
> Fixes: eb1723a29b9a ("xen-netback: refactor guest rx")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>

LGTM

Acked-by: Paul Durrant <paul.durrant@...rix.com>

> ---
>  drivers/net/xen-netback/rx.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/xen-netback/rx.c b/drivers/net/xen-netback/rx.c
> index 8e9ade6ccf18..aeb150258c6c 100644
> --- a/drivers/net/xen-netback/rx.c
> +++ b/drivers/net/xen-netback/rx.c
> @@ -337,9 +337,9 @@ static void xenvif_rx_next_chunk(struct
> xenvif_queue *queue,
>  	frag_data += pkt->frag_offset;
>  	frag_len -= pkt->frag_offset;
> 
> -	chunk_len = min(frag_len, XEN_PAGE_SIZE - offset);
> -	chunk_len = min(chunk_len,
> -			XEN_PAGE_SIZE -
> 	xen_offset_in_page(frag_data));
> +	chunk_len = min_t(size_t, frag_len, XEN_PAGE_SIZE - offset);
> +	chunk_len = min_t(size_t, chunk_len, XEN_PAGE_SIZE -
> +					     xen_offset_in_page(frag_data));
> 
>  	pkt->frag_offset += chunk_len;
> 
> --
> 2.9.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ