Linux NFS development
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: nfs@lists.sourceforge.net
Subject: Re: [PATCH 1/7] SUNRPC: Address a few compiler warnings in the RPC client
Date: Mon, 27 Aug 2007 15:15:26 -0400	[thread overview]
Message-ID: <46D322CE.40002@oracle.com> (raw)
In-Reply-To: <1188238002.6701.99.camel@heimdal.trondhjem.org>

[-- Attachment #1: Type: text/plain, Size: 1905 bytes --]

>> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
>> index c796e2f..0ad3042 100644
>> --- a/net/sunrpc/clnt.c
>> +++ b/net/sunrpc/clnt.c
>> @@ -127,7 +127,7 @@ static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, s
>>  	struct rpc_clnt		*clnt = NULL;
>>  	struct rpc_auth		*auth;
>>  	int err;
>> -	int len;
>> +	size_t len;
> 
> What if 'len' overflows when we do 'strlen() + 1'?

strlen() returns size_t, which is unsigned.  Thus the overflow would be 
zero.  Seems like that's a better outcome than what would happen today.

>>  	dprintk("RPC:       creating %s client for %s (xprt %p)\n",
>>  			program->name, servname, xprt);
>> @@ -436,7 +436,7 @@ rpc_release_client(struct rpc_clnt *clnt)
>>   */
>>  struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old,
>>  				      struct rpc_program *program,
>> -				      int vers)
>> +				      unsigned int vers)
>>  {
>>  	struct rpc_clnt *clnt;
>>  	struct rpc_version *version;
>> @@ -1508,6 +1508,7 @@ void rpc_show_tasks(void)
>>  {
>>  	struct rpc_clnt *clnt;
>>  	struct rpc_task *t;
>> +	int proc = -1;
>>  
>>  	spin_lock(&rpc_client_lock);
>>  	if (list_empty(&all_clients))
>> @@ -1524,9 +1525,11 @@ void rpc_show_tasks(void)
>>  			if (RPC_IS_QUEUED(t))
>>  				rpc_waitq = rpc_qname(t->u.tk_wait.rpc_waitq);
>>  
>> +			if (t->tk_msg.rpc_proc)
>> +				proc = t->tk_msg.rpc_proc->p_proc;
>> +
>>  			printk("%5u %04d %04x %6d %8p %6d %8p %8ld %8s %8p %8p\n",
>> -				t->tk_pid,
>> -				(t->tk_msg.rpc_proc ? t->tk_msg.rpc_proc->p_proc : -1),
>> +				t->tk_pid, proc,
>>  				t->tk_flags, t->tk_status,
>>  				t->tk_client,
>>  				(t->tk_client ? t->tk_client->cl_prog : 0),
> 
> NACK. Look again at your change to rpc_show_tasks. What you are doing
> with your variable 'proc' is _not_ equivalent to the existing code: you
> need to reset proc to '-1' each time you go through the loop.

Noted and fixed.

[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 302 bytes --]

begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture: Linux Projects Group
adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA
title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
url:http://oss.oracle.com/~cel
version:2.1
end:vcard


[-- Attachment #3: Type: text/plain, Size: 315 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 140 bytes --]

_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

       reply	other threads:[~2007-08-27 19:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070827173013.23426.67897.stgit@monet.1015granger.net>
     [not found] ` <1188238002.6701.99.camel@heimdal.trondhjem.org>
2007-08-27 19:15   ` Chuck Lever [this message]
2007-08-27 21:59     ` [PATCH 1/7] SUNRPC: Address a few compiler warnings in the RPC client Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46D322CE.40002@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=nfs@lists.sourceforge.net \
    --cc=trond.myklebust@fys.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox