public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Type cast some size_t arguments to 'unsigned int' to avoid (harmless) gcc printk warnings.
@ 2007-05-08 18:29 Chris Wedgwood
  2007-05-08 20:03 ` Alexey Dobriyan
  2007-05-09  3:41 ` H. Peter Anvin
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Wedgwood @ 2007-05-08 18:29 UTC (permalink / raw)
  To: linux-kernel

Signed-off-by: Chris Wedgwood <cw@f00f.org>
---
 net/sunrpc/sched.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 4a53e94..60df3c1 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -764,7 +764,7 @@ void *rpc_malloc(struct rpc_task *task, size_t size)
 		buf = kmalloc(size, gfp);
 	*buf = size;
 	dprintk("RPC: %5u allocated buffer of size %u at %p\n",
-			task->tk_pid, size, buf);
+			task->tk_pid, (unsigned int)size, buf);
 	return (void *) ++buf;
 }
 
@@ -783,7 +783,7 @@ void rpc_free(void *buffer)
 	buf--;
 
 	dprintk("RPC:       freeing buffer of size %u at %p\n",
-			size, buf);
+			(unsigned int)size, buf);
 	if (size <= RPC_BUFFER_MAXSIZE)
 		mempool_free(buf, rpc_buffer_mempool);
 	else
-- 
1.5.1.3


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

* Re: [PATCH] Type cast some size_t arguments to 'unsigned int' to avoid (harmless) gcc printk warnings.
  2007-05-08 18:29 [PATCH] Type cast some size_t arguments to 'unsigned int' to avoid (harmless) gcc printk warnings Chris Wedgwood
@ 2007-05-08 20:03 ` Alexey Dobriyan
  2007-05-08 20:06   ` Chris Wedgwood
  2007-05-09  3:41 ` H. Peter Anvin
  1 sibling, 1 reply; 4+ messages in thread
From: Alexey Dobriyan @ 2007-05-08 20:03 UTC (permalink / raw)
  To: Chris Wedgwood; +Cc: linux-kernel

On Tue, May 08, 2007 at 11:29:26AM -0700, Chris Wedgwood wrote:
> --- a/net/sunrpc/sched.c
> +++ b/net/sunrpc/sched.c
> @@ -764,7 +764,7 @@ void *rpc_malloc(struct rpc_task *task, size_t size)
>  		buf = kmalloc(size, gfp);
>  	*buf = size;
>  	dprintk("RPC: %5u allocated buffer of size %u at %p\n",
> -			task->tk_pid, size, buf);
> +			task->tk_pid, (unsigned int)size, buf);
>  	return (void *) ++buf;
>  }
>  
> @@ -783,7 +783,7 @@ void rpc_free(void *buffer)
>  	buf--;
>  
>  	dprintk("RPC:       freeing buffer of size %u at %p\n",
> -			size, buf);
> +			(unsigned int)size, buf);

For one, size_t should be printed with %zu.
For two, this is already fixed in mainline.


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

* Re: [PATCH] Type cast some size_t arguments to 'unsigned int' to avoid (harmless) gcc printk warnings.
  2007-05-08 20:03 ` Alexey Dobriyan
@ 2007-05-08 20:06   ` Chris Wedgwood
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Wedgwood @ 2007-05-08 20:06 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: linux-kernel

On Wed, May 09, 2007 at 12:03:19AM +0400, Alexey Dobriyan wrote:

> For one, size_t should be printed with %zu.

thanks, i wasn't aware of this

> For two, this is already fixed in mainline.

this was against mainline that wasn't more than an hour old when i
sent the patch

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

* Re: [PATCH] Type cast some size_t arguments to 'unsigned int' to avoid (harmless) gcc printk warnings.
  2007-05-08 18:29 [PATCH] Type cast some size_t arguments to 'unsigned int' to avoid (harmless) gcc printk warnings Chris Wedgwood
  2007-05-08 20:03 ` Alexey Dobriyan
@ 2007-05-09  3:41 ` H. Peter Anvin
  1 sibling, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2007-05-09  3:41 UTC (permalink / raw)
  To: Chris Wedgwood; +Cc: linux-kernel

Chris Wedgwood wrote:
> Signed-off-by: Chris Wedgwood <cw@f00f.org>
> ---
>  net/sunrpc/sched.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
> index 4a53e94..60df3c1 100644
> --- a/net/sunrpc/sched.c
> +++ b/net/sunrpc/sched.c
> @@ -764,7 +764,7 @@ void *rpc_malloc(struct rpc_task *task, size_t size)
>  		buf = kmalloc(size, gfp);
>  	*buf = size;
>  	dprintk("RPC: %5u allocated buffer of size %u at %p\n",
> -			task->tk_pid, size, buf);
> +			task->tk_pid, (unsigned int)size, buf);
>  	return (void *) ++buf;
>  }
>  
> @@ -783,7 +783,7 @@ void rpc_free(void *buffer)
>  	buf--;
>  
>  	dprintk("RPC:       freeing buffer of size %u at %p\n",
> -			size, buf);
> +			(unsigned int)size, buf);
>  	if (size <= RPC_BUFFER_MAXSIZE)
>  		mempool_free(buf, rpc_buffer_mempool);
>  	else

NAK.  This is wrong for multiple reasons.
Use %zu instead.

	-hpa



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

end of thread, other threads:[~2007-05-09  3:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-08 18:29 [PATCH] Type cast some size_t arguments to 'unsigned int' to avoid (harmless) gcc printk warnings Chris Wedgwood
2007-05-08 20:03 ` Alexey Dobriyan
2007-05-08 20:06   ` Chris Wedgwood
2007-05-09  3:41 ` H. Peter Anvin

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