
From: "KAMBAROV, ZAUR" <kambarov@berkeley.edu>

Later in __xprt_lock_write() we check to see if `task' is NULL, we we should
check it before dereferencing it here.

But we dereference `task' later on in the function, too.  I suspect that the
check for NULL in there is unneeded?


This defect was found automatically by Coverity Prevent, a static analysis
tool.

Signed-off-by: Zaur Kambarov <zkambarov@coverity.com> 
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 net/sunrpc/xprt.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -puN net/sunrpc/xprt.c~coverity-sunrpc-xprt-task-null-check net/sunrpc/xprt.c
--- devel/net/sunrpc/xprt.c~coverity-sunrpc-xprt-task-null-check	2005-06-30 23:15:46.000000000 -0700
+++ devel-akpm/net/sunrpc/xprt.c	2005-06-30 23:15:46.000000000 -0700
@@ -140,7 +140,10 @@ xprt_from_sock(struct sock *sk)
 static int
 __xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task)
 {
-	struct rpc_rqst *req = task->tk_rqstp;
+        struct rpc_rqst *req = NULL;
+
+	if (task)
+                req = task->tk_rqstp;
 
 	if (test_and_set_bit(XPRT_LOCKED, &xprt->sockstate)) {
 		if (task == xprt->snd_task)
_
