public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH] xen: netback: fix error printf format string.
@ 2015-05-29 16:22 Ian Campbell
  2015-05-29 16:24 ` Wei Liu
  2015-06-01  4:26 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Ian Campbell @ 2015-05-29 16:22 UTC (permalink / raw)
  To: xen-devel, netdev; +Cc: wei.liu2, Ian Campbell

drivers/net/xen-netback/netback.c: In function ‘xenvif_tx_build_gops’:
drivers/net/xen-netback/netback.c:1253:8: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘int’ [-Wformat=]
        (txreq.offset&~PAGE_MASK) + txreq.size);
        ^

txreq.offset and .size are uint16_t fields.

Signed-off-by: Ian Campbell <ian.campbell@citrix•com>
---
 drivers/net/xen-netback/netback.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 4de46aa..a3b1cbb 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -1248,7 +1248,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
 		/* No crossing a page as the payload mustn't fragment. */
 		if (unlikely((txreq.offset + txreq.size) > PAGE_SIZE)) {
 			netdev_err(queue->vif->dev,
-				   "txreq.offset: %x, size: %u, end: %lu\n",
+				   "txreq.offset: %x, size: %u, end: %u\n",
 				   txreq.offset, txreq.size,
 				   (txreq.offset&~PAGE_MASK) + txreq.size);
 			xenvif_fatal_tx_err(queue->vif);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen: netback: fix error printf format string.
  2015-05-29 16:22 [PATCH] xen: netback: fix error printf format string Ian Campbell
@ 2015-05-29 16:24 ` Wei Liu
  2015-06-01  4:26 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Wei Liu @ 2015-05-29 16:24 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel, netdev, wei.liu2

On Fri, May 29, 2015 at 05:22:04PM +0100, Ian Campbell wrote:
> drivers/net/xen-netback/netback.c: In function ‘xenvif_tx_build_gops’:
> drivers/net/xen-netback/netback.c:1253:8: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘int’ [-Wformat=]
>         (txreq.offset&~PAGE_MASK) + txreq.size);
>         ^
> 
> txreq.offset and .size are uint16_t fields.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix•com>

Acked-by: Wei Liu <wei.liu2@citrix•com>

> ---
>  drivers/net/xen-netback/netback.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
> index 4de46aa..a3b1cbb 100644
> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -1248,7 +1248,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
>  		/* No crossing a page as the payload mustn't fragment. */
>  		if (unlikely((txreq.offset + txreq.size) > PAGE_SIZE)) {
>  			netdev_err(queue->vif->dev,
> -				   "txreq.offset: %x, size: %u, end: %lu\n",
> +				   "txreq.offset: %x, size: %u, end: %u\n",
>  				   txreq.offset, txreq.size,
>  				   (txreq.offset&~PAGE_MASK) + txreq.size);
>  			xenvif_fatal_tx_err(queue->vif);
> -- 
> 1.7.10.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen: netback: fix error printf format string.
  2015-05-29 16:22 [PATCH] xen: netback: fix error printf format string Ian Campbell
  2015-05-29 16:24 ` Wei Liu
@ 2015-06-01  4:26 ` David Miller
  2015-06-01  8:29   ` Ian Campbell
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2015-06-01  4:26 UTC (permalink / raw)
  To: ian.campbell; +Cc: xen-devel, netdev, wei.liu2

From: Ian Campbell <ian.campbell@citrix•com>
Date: Fri, 29 May 2015 17:22:04 +0100

> drivers/net/xen-netback/netback.c: In function ‘xenvif_tx_build_gops’:
> drivers/net/xen-netback/netback.c:1253:8: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘int’ [-Wformat=]
>         (txreq.offset&~PAGE_MASK) + txreq.size);
>         ^
> 
> txreq.offset and .size are uint16_t fields.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix•com>

This may get rid of the compiler warning on your machine, but it creates
one on mine:

drivers/net/xen-netback/netback.c: In function ‘xenvif_tx_build_gops’:
drivers/net/xen-netback/netback.c:1253:8: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 5 has type ‘long unsigned int’ [-Wformat=]
        (txreq.offset&~PAGE_MASK) + txreq.size);
        ^

There is a type involved in this calculation which is arch
dependent, so you'll need to add a cast or something to
make this warning go away in all cases.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen: netback: fix error printf format string.
  2015-06-01  4:26 ` David Miller
@ 2015-06-01  8:29   ` Ian Campbell
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2015-06-01  8:29 UTC (permalink / raw)
  To: David Miller; +Cc: xen-devel, netdev, wei.liu2

On Sun, 2015-05-31 at 21:26 -0700, David Miller wrote:
> From: Ian Campbell <ian.campbell@citrix•com>
> Date: Fri, 29 May 2015 17:22:04 +0100
> 
> > drivers/net/xen-netback/netback.c: In function ‘xenvif_tx_build_gops’:
> > drivers/net/xen-netback/netback.c:1253:8: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘int’ [-Wformat=]
> >         (txreq.offset&~PAGE_MASK) + txreq.size);
> >         ^
> > 
> > txreq.offset and .size are uint16_t fields.
> > 
> > Signed-off-by: Ian Campbell <ian.campbell@citrix•com>
> 
> This may get rid of the compiler warning on your machine, but it creates
> one on mine:
> 
> drivers/net/xen-netback/netback.c: In function ‘xenvif_tx_build_gops’:
> drivers/net/xen-netback/netback.c:1253:8: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 5 has type ‘long unsigned int’ [-Wformat=]
>         (txreq.offset&~PAGE_MASK) + txreq.size);
>         ^
> 
> There is a type involved in this calculation which is arch
> dependent, so you'll need to add a cast or something to
> make this warning go away in all cases.

Ah, I only considered the types txreq.{offset,size} and missed thinking
about PAGE_MASK.

I'll resend with a cast.

Ian.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-01  8:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-29 16:22 [PATCH] xen: netback: fix error printf format string Ian Campbell
2015-05-29 16:24 ` Wei Liu
2015-06-01  4:26 ` David Miller
2015-06-01  8:29   ` Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox