* [PATCH] xen-netback: fix type mismatch warning
@ 2016-10-12 14:54 Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-10-12 14:54 UTC (permalink / raw)
To: Wei Liu, Paul Durrant
Cc: Arnd Bergmann, netdev, linux-kernel, David Vrabel, xen-devel,
David S. Miller
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@arndb.de>
---
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
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xen-netback: fix type mismatch warning
[not found] <20161012145434.2493788-1-arnd@arndb.de>
@ 2016-10-13 1:22 ` Paul Durrant
2016-10-13 15:02 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Paul Durrant @ 2016-10-13 1:22 UTC (permalink / raw)
To: Arnd Bergmann, Wei Liu
Cc: xen-devel@lists.xenproject.org, netdev@vger.kernel.org,
David S. Miller, linux-kernel@vger.kernel.org, David Vrabel
> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> Sent: 12 October 2016 10:54
> To: Wei Liu <wei.liu2@citrix.com>; Paul Durrant <Paul.Durrant@citrix.com>
> Cc: Arnd Bergmann <arnd@arndb.de>; David S. Miller
> <davem@davemloft.net>; David Vrabel <david.vrabel@citrix.com>; xen-
> devel@lists.xenproject.org; netdev@vger.kernel.org; linux-
> kernel@vger.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@arndb.de>
LGTM
Acked-by: Paul Durrant <paul.durrant@citrix.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
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xen-netback: fix type mismatch warning
[not found] <20161012145434.2493788-1-arnd@arndb.de>
2016-10-13 1:22 ` [PATCH] xen-netback: fix type mismatch warning Paul Durrant
@ 2016-10-13 15:02 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-10-13 15:02 UTC (permalink / raw)
To: arnd; +Cc: wei.liu2, netdev, linux-kernel, paul.durrant, david.vrabel,
xen-devel
From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 12 Oct 2016 16:54:01 +0200
> 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@arndb.de>
Applied, thanks.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-13 15:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20161012145434.2493788-1-arnd@arndb.de>
2016-10-13 1:22 ` [PATCH] xen-netback: fix type mismatch warning Paul Durrant
2016-10-13 15:02 ` David Miller
2016-10-12 14:54 Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).