All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] fs: nfs: dir.c: Fix sparse error
@ 2019-12-06 15:16 ` madhuparnabhowmik04
  0 siblings, 0 replies; 20+ messages in thread
From: madhuparnabhowmik04 @ 2019-12-06 15:16 UTC (permalink / raw)
  To: trond.myklebust, anna.schumaker, joel
  Cc: linux-nfs, rcu, linux-kernel-mentees, linux-kernel, Madhuparna Bhowmik

From: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>

This patch fixes the following errors:
fs/nfs/dir.c:2353:14: error: incompatible types in comparison expression (different address spaces):
fs/nfs/dir.c:2353:14:    struct list_head [noderef] <asn:4> *
fs/nfs/dir.c:2353:14:    struct list_head *

caused due to directly accessing the prev pointer of
a RCU protected list.
Accessing the pointer using the macro list_prev_rcu() fixes this error.

Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>
---
 fs/nfs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index e180033e35cf..2035254cc283 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2350,7 +2350,7 @@ static int nfs_access_get_cached_rcu(struct inode *inode, const struct cred *cre
 	rcu_read_lock();
 	if (nfsi->cache_validity & NFS_INO_INVALID_ACCESS)
 		goto out;
-	lh = rcu_dereference(nfsi->access_cache_entry_lru.prev);
+	lh = rcu_dereference(list_prev_rcu(&nfsi->access_cache_entry_lru));
 	cache = list_entry(lh, struct nfs_access_entry, lru);
 	if (lh == &nfsi->access_cache_entry_lru ||
 	    cred != cache->cred)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2019-12-13  1:16 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06 15:16 [PATCH 2/2] fs: nfs: dir.c: Fix sparse error madhuparnabhowmik04
2019-12-06 15:16 ` [Linux-kernel-mentees] " madhuparnabhowmik04
2019-12-06 16:00 ` Joel Fernandes
2019-12-06 16:00   ` [Linux-kernel-mentees] " Joel Fernandes
2019-12-06 16:12   ` Paul E. McKenney
2019-12-06 16:12     ` [Linux-kernel-mentees] " Paul E. McKenney
2019-12-06 16:02 ` Paul E. McKenney
2019-12-06 16:02   ` [Linux-kernel-mentees] " Paul E. McKenney
2019-12-06 17:52   ` Trond Myklebust
2019-12-06 17:52     ` [Linux-kernel-mentees] " Trond Myklebust
2019-12-06 18:24     ` Paul E. McKenney
2019-12-06 18:24       ` [Linux-kernel-mentees] " Paul E. McKenney
2019-12-06 18:28       ` Trond Myklebust
2019-12-06 18:28         ` [Linux-kernel-mentees] " Trond Myklebust
2019-12-06 18:45         ` Paul E. McKenney
2019-12-06 18:45           ` [Linux-kernel-mentees] " Paul E. McKenney
2019-12-12 21:55   ` Joel Fernandes
2019-12-12 21:55     ` [Linux-kernel-mentees] " Joel Fernandes
2019-12-13  1:16     ` Paul E. McKenney
2019-12-13  1:16       ` [Linux-kernel-mentees] " Paul E. McKenney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.