public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields-uC3wQj2KruNg9hUCZPvPmw@public•gmane.org>
To: Jiri Slaby <jslaby-AlSwsSmVLrQ@public•gmane.org>
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public•gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public•gmane.org,
	Neil Brown <neilb-l3A5Bk7waGM@public•gmane.org>,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	Trond Myklebust <trond-HgOvQuBEEgTQT0dZR+AlfA@public•gmane.org>
Subject: Re: [PATCH] NET: sunrpc, remove unneeded NULL tests
Date: Fri, 12 Nov 2010 14:14:33 -0500	[thread overview]
Message-ID: <20101112191433.GC32745@fieldses.org> (raw)
In-Reply-To: <1288180325-20009-1-git-send-email-jslaby-AlSwsSmVLrQ@public.gmane.org>

Sorry for the slow response, this one's for Trond if it hasn't already
been handled.

--b.

On Wed, Oct 27, 2010 at 01:52:05PM +0200, Jiri Slaby wrote:
> Stanse found that req in xprt_reserve_xprt is dereferenced prior its
> test to NULL. If that's the case, the checks are unnecessary, so
> remove them.
> 
> The alternative is not to dereference it before the test. The patch
> is to point out the problem, you have to decide.
> 
> Signed-off-by: Jiri Slaby <jslaby-AlSwsSmVLrQ@public•gmane.org>
> Cc: "J. Bruce Fields" <bfields-uC3wQj2KruNg9hUCZPvPmw@public•gmane.org>
> Cc: Neil Brown <neilb-l3A5Bk7waGM@public•gmane.org>
> Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA@public•gmane.org
> ---
>  net/sunrpc/xprt.c |    8 +++-----
>  1 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
> index 4c8f18a..5355c71 100644
> --- a/net/sunrpc/xprt.c
> +++ b/net/sunrpc/xprt.c
> @@ -202,10 +202,8 @@ int xprt_reserve_xprt(struct rpc_task *task)
>  		goto out_sleep;
>  	}
>  	xprt->snd_task = task;
> -	if (req) {
> -		req->rq_bytes_sent = 0;
> -		req->rq_ntrans++;
> -	}
> +	req->rq_bytes_sent = 0;
> +	req->rq_ntrans++;
>  	return 1;
>  
>  out_sleep:
> @@ -213,7 +211,7 @@ out_sleep:
>  			task->tk_pid, xprt);
>  	task->tk_timeout = 0;
>  	task->tk_status = -EAGAIN;
> -	if (req && req->rq_ntrans)
> +	if (req->rq_ntrans)
>  		rpc_sleep_on(&xprt->resend, task, NULL);
>  	else
>  		rpc_sleep_on(&xprt->sending, task, NULL);
> -- 
> 1.7.3.1
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public•gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2010-11-12 19:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 11:52 [PATCH] NET: sunrpc, remove unneeded NULL tests Jiri Slaby
     [not found] ` <1288180325-20009-1-git-send-email-jslaby-AlSwsSmVLrQ@public.gmane.org>
2010-11-12 19:14   ` J. Bruce Fields [this message]

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=20101112191433.GC32745@fieldses.org \
    --to=bfields-uc3wqj2krung9huczpvpmw@public$(echo .)gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public$(echo .)gmane.org \
    --cc=jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public$(echo .)gmane.org \
    --cc=jslaby-AlSwsSmVLrQ@public$(echo .)gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=neilb-l3A5Bk7waGM@public$(echo .)gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=trond-HgOvQuBEEgTQT0dZR+AlfA@public$(echo .)gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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