diff options
author | Jeff Layton <jlayton@primarydata.com> | 2014-07-15 12:59:36 -0400 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2018-11-20 18:05:28 +0000 |
commit | affe5a9da5fd146816a32e18fd163f1f9b19de3a (patch) | |
tree | bcd3314f544bb733d9be74c4e5831062c3389198 | |
parent | 1c3646d7fc89a3df21dc7f5dffb6b05155df2b2e (diff) | |
download | linux-stable-affe5a9da5fd146816a32e18fd163f1f9b19de3a.tar.gz linux-stable-affe5a9da5fd146816a32e18fd163f1f9b19de3a.tar.bz2 linux-stable-affe5a9da5fd146816a32e18fd163f1f9b19de3a.zip |
nfsd: silence sparse warning about accessing credentials
commit ae4b884fc6316b3190be19448cea24b020c1cad6 upstream.
sparse says:
fs/nfsd/auth.c:31:38: warning: incorrect type in argument 1 (different address spaces)
fs/nfsd/auth.c:31:38: expected struct cred const *cred
fs/nfsd/auth.c:31:38: got struct cred const [noderef] <asn:4>*real_cred
Add a new accessor for the ->real_cred and use that to fetch the
pointer. Accessing current->real_cred directly is actually quite safe
since we know that they can't go away so this is mostly a cosmetic fixup
to silence sparse.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | fs/nfsd/auth.c | 2 | ||||
-rw-r--r-- | include/linux/cred.h | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c index d69895622d4d..6b8b16d79d76 100644 --- a/fs/nfsd/auth.c +++ b/fs/nfsd/auth.c @@ -28,7 +28,7 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp) validate_process_creds(); /* discard any old override before preparing the new set */ - revert_creds(get_cred(current->real_cred)); + revert_creds(get_cred(current_real_cred())); new = prepare_creds(); if (!new) return -ENOMEM; diff --git a/include/linux/cred.h b/include/linux/cred.h index ad9af5c7f246..e8b8574f57dc 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h @@ -261,6 +261,15 @@ static inline void put_cred(const struct cred *_cred) rcu_dereference_protected(current->cred, 1) /** + * current_real_cred - Access the current task's objective credentials + * + * Access the objective credentials of the current task. RCU-safe, + * since nobody else can modify it. + */ +#define current_real_cred() \ + rcu_dereference_protected(current->real_cred, 1) + +/** * __task_cred - Access a task's objective credentials * @task: The task to query * |