All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfsd4: fix printk format string in nfsd4_open
@ 2013-12-09 17:05 Benny Halevy
  2013-12-12 16:19 ` J. Bruce Fields
  0 siblings, 1 reply; 4+ messages in thread
From: Benny Halevy @ 2013-12-09 17:05 UTC (permalink / raw)
  To: bfields; +Cc: linux-nfs, Benny Halevy

Signed-off-by: Benny Halevy <bhalevy@primarydata.com>
---
 fs/nfsd/nfs4proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 0a964f1..8624bee 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -361,7 +361,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 	struct net *net = SVC_NET(rqstp);
 	struct nfsd_net *nn = net_generic(net, nfsd_net_id);
 
-	dprintk("NFSD: nfsd4_open filename %.*s op_openowner %p\n",
+	dprintk("NFSD: nfsd4_open filename %*s op_openowner %p\n",
 		(int)open->op_fname.len, open->op_fname.data,
 		open->op_openowner);
 
-- 
1.8.3.1


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

* Re: [PATCH] nfsd4: fix printk format string in nfsd4_open
  2013-12-09 17:05 [PATCH] nfsd4: fix printk format string in nfsd4_open Benny Halevy
@ 2013-12-12 16:19 ` J. Bruce Fields
  2013-12-13  9:55   ` Benny Halevy
  0 siblings, 1 reply; 4+ messages in thread
From: J. Bruce Fields @ 2013-12-12 16:19 UTC (permalink / raw)
  To: Benny Halevy; +Cc: bfields, linux-nfs

On Mon, Dec 09, 2013 at 07:05:43PM +0200, Benny Halevy wrote:
> Signed-off-by: Benny Halevy <bhalevy@primarydata.com>

Are you sure?  Reminding myself from the sprintf man page.... %*s
provides padding, %.*s limits the number of characters taken from the
string.  We need that limit since there's no guarantee of null
termination here.

--b.

> ---
>  fs/nfsd/nfs4proc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 0a964f1..8624bee 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -361,7 +361,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>  	struct net *net = SVC_NET(rqstp);
>  	struct nfsd_net *nn = net_generic(net, nfsd_net_id);
>  
> -	dprintk("NFSD: nfsd4_open filename %.*s op_openowner %p\n",
> +	dprintk("NFSD: nfsd4_open filename %*s op_openowner %p\n",
>  		(int)open->op_fname.len, open->op_fname.data,
>  		open->op_openowner);
>  
> -- 
> 1.8.3.1
> 

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

* Re: [PATCH] nfsd4: fix printk format string in nfsd4_open
  2013-12-12 16:19 ` J. Bruce Fields
@ 2013-12-13  9:55   ` Benny Halevy
  2013-12-13 12:30     ` Jim Rees
  0 siblings, 1 reply; 4+ messages in thread
From: Benny Halevy @ 2013-12-13  9:55 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: bfields, linux-nfs



On 12/12/2013 06:19 PM, J. Bruce Fields wrote:
> On Mon, Dec 09, 2013 at 07:05:43PM +0200, Benny Halevy wrote:
>> Signed-off-by: Benny Halevy <bhalevy@primarydata.com>
> 
> Are you sure?  Reminding myself from the sprintf man page.... %*s
> provides padding, %.*s limits the number of characters taken from the
> string.  We need that limit since there's no guarantee of null
> termination here.

Well, the .* format doesn't seem to be supported in the kernel library as
far as I could tell. At least it doesn't work for me. We may need to copy
the string and null terminate it if it's indeed the case.

Benny

> 
> --b.
> 
>> ---
>>  fs/nfsd/nfs4proc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
>> index 0a964f1..8624bee 100644
>> --- a/fs/nfsd/nfs4proc.c
>> +++ b/fs/nfsd/nfs4proc.c
>> @@ -361,7 +361,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>>  	struct net *net = SVC_NET(rqstp);
>>  	struct nfsd_net *nn = net_generic(net, nfsd_net_id);
>>  
>> -	dprintk("NFSD: nfsd4_open filename %.*s op_openowner %p\n",
>> +	dprintk("NFSD: nfsd4_open filename %*s op_openowner %p\n",
>>  		(int)open->op_fname.len, open->op_fname.data,
>>  		open->op_openowner);
>>  
>> -- 
>> 1.8.3.1
>>

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

* Re: [PATCH] nfsd4: fix printk format string in nfsd4_open
  2013-12-13  9:55   ` Benny Halevy
@ 2013-12-13 12:30     ` Jim Rees
  0 siblings, 0 replies; 4+ messages in thread
From: Jim Rees @ 2013-12-13 12:30 UTC (permalink / raw)
  To: Benny Halevy; +Cc: J. Bruce Fields, bfields, linux-nfs

Benny Halevy wrote:

  On 12/12/2013 06:19 PM, J. Bruce Fields wrote:
  > On Mon, Dec 09, 2013 at 07:05:43PM +0200, Benny Halevy wrote:
  >> Signed-off-by: Benny Halevy <bhalevy@primarydata.com>
  > 
  > Are you sure?  Reminding myself from the sprintf man page.... %*s
  > provides padding, %.*s limits the number of characters taken from the
  > string.  We need that limit since there's no guarantee of null
  > termination here.
  
  Well, the .* format doesn't seem to be supported in the kernel library as
  far as I could tell. At least it doesn't work for me. We may need to copy
  the string and null terminate it if it's indeed the case.

There's nothing about strings in Documentation/printk-formats.txt, but if
you look at lib/vsprintf.c, it's clearly trying to support precision. The
precision is parsed in format_decode(), and used to limit the string length
in string().

String precision is used other places in the kernel, too:
% fgrep -l '%.*s' {kernel,fs}/*.c
kernel/hung_task.c
kernel/lockdep.c
fs/dcache.c
fs/filesystems.c

So I would be surprised if it doesn't work.

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

end of thread, other threads:[~2013-12-13 12:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-09 17:05 [PATCH] nfsd4: fix printk format string in nfsd4_open Benny Halevy
2013-12-12 16:19 ` J. Bruce Fields
2013-12-13  9:55   ` Benny Halevy
2013-12-13 12:30     ` Jim Rees

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.