Re: [PATCH] Fix for possible null pointer dereference in auth.c

From: Sergei Shtylyov
Date: Fri May 16 2014 - 08:19:42 EST


Hello.

On 16-05-2014 1:56, Rickard Strandqvist wrote:

There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
---
net/sunrpc/auth.c | 10 +++++++---
1 fil Ãndrad, 7 tillÃgg(+), 3 borttagningar(-)

diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 5285ead..3a55698 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -801,10 +801,14 @@ rpcauth_invalcred(struct rpc_task *task)
{
struct rpc_cred *cred = task->tk_rqstp->rq_cred;

- dprintk("RPC: %5u invalidating %s cred %p\n",
- task->tk_pid, cred->cr_auth->au_ops->au_name, cred);
- if (cred)
+ if (cred) {
+ dprintk("RPC: %5u invalidating %s cred %p\n",
+ task->tk_pid, cred->cr_auth->au_ops->au_name, cred);
+
clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
+ }
+ else

} and *else* should be on the same line, and there should be {} in the *else* arm since there's {} in the *if* arm already, according to Documentation/CodingStyle.

+ dprintk("RPC: %5u invalidating is NULL\n", task->tk_pid);

That's not a proper English, I'm afraid.

}

WBR, Sergei


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/