Skip to content

Commit

Permalink
NFS: Fix up a sparse warning
Browse files Browse the repository at this point in the history
sparse is warning about an incorrect RCU dereference.
fs/nfs/dir.c:2965:56: warning: incorrect type in argument 1 (different address spaces)
fs/nfs/dir.c:2965:56:    expected struct cred const *
fs/nfs/dir.c:2965:56:    got struct cred const [noderef] __rcu *const cred

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
  • Loading branch information
Trond Myklebust committed Jan 2, 2023
1 parent 029085b commit 5e9a7b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/nfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -2957,12 +2957,14 @@ static u64 nfs_access_login_time(const struct task_struct *task,
const struct cred *cred)
{
const struct task_struct *parent;
const struct cred *pcred;
u64 ret;

rcu_read_lock();
for (;;) {
parent = rcu_dereference(task->real_parent);
if (parent == task || cred_fscmp(parent->cred, cred) != 0)
pcred = rcu_dereference(parent->cred);
if (parent == task || cred_fscmp(pcred, cred) != 0)
break;
task = parent;
}
Expand Down

0 comments on commit 5e9a7b9

Please sign in to comment.