[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1288180325-20009-1-git-send-email-jslaby@suse.cz>
Date: Wed, 27 Oct 2010 13:52:05 +0200
From: Jiri Slaby <jslaby@...e.cz>
To: bfields@...ldses.org
Cc: davem@...emloft.net, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, jirislaby@...il.com,
Neil Brown <neilb@...e.de>, linux-nfs@...r.kernel.org
Subject: [PATCH] NET: sunrpc, remove unneeded NULL tests
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@...e.cz>
Cc: "J. Bruce Fields" <bfields@...ldses.org>
Cc: Neil Brown <neilb@...e.de>
Cc: linux-nfs@...r.kernel.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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists