Skip to contentSkip to conversation

net/sunrpc/auth.c: move NULL check in rpcauth_invalcred() before first dereference

PATCH Applied Radmila Kompová 1 participant 1 message May 2, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 net/sunrpc/auth.c: move NULL check in rpcauth_invalcred() before first dereference

Detected by cppcheck.

---
 net/sunrpc/auth.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
net/sunrpc/auth.c +3 -2
index ed2fdd2..cba5529 100644
@@ -767,11 +767,12 @@ void
 rpcauth_invalcred(struct rpc_task *task)
 {
 	struct rpc_cred *cred = task->tk_rqstp->rq_cred;
+	if (!cred)
+		return;
 
 	dprintk("RPC: %5u invalidating %s cred %p\n",
 		task->tk_pid, cred->cr_auth->au_ops->au_name, cred);
-	if (cred)
-		clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
+	clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
 }
 
 int
Signature · 1 line
1.8.1.5