linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] SUNRPC: remove an unneeded NULL check in xprt_connect()
@ 2012-02-01  7:46 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2012-02-01  7:46 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: Trond Myklebust, David S. Miller, linux-nfs, netdev,
	kernel-janitors

We check "task->tk_rqstp" and then we dereference it without checking on
the next line.  The only caller is call_connect() and that has a check
which prevents it from calling xprt_connect() with a NULL.

                if (task->tk_status < 0)
                        return;

If "task->tk_rqstp" were NULL then "tk_status" would be -EAGAIN.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 839f6ef..efe5495 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -715,9 +715,7 @@ void xprt_connect(struct rpc_task *task)
 	if (xprt_connected(xprt))
 		xprt_release_write(xprt, task);
 	else {
-		if (task->tk_rqstp)
-			task->tk_rqstp->rq_bytes_sent = 0;
-
+		task->tk_rqstp->rq_bytes_sent = 0;
 		task->tk_timeout = task->tk_rqstp->rq_timeout;
 		rpc_sleep_on(&xprt->pending, task, xprt_connect_status);
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-02-01  7:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-01  7:46 [patch] SUNRPC: remove an unneeded NULL check in xprt_connect() Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).