[srcu] Can we suppress sparse warning?

From: Tetsuo Handa
Date: Wed Nov 09 2016 - 06:37:01 EST


Hello.

When I build

---------- test/test.c ----------
#include <linux/module.h>

static int __init test_init(void)
{
DEFINE_SRCU(srcu);
int idx = srcu_read_lock(&srcu);
void *ptr = srcu_dereference(ptr, &srcu);
srcu_read_unlock(&srcu, idx);
return -EINVAL;
}

module_init(test_init);
MODULE_LICENSE("GPL");
---------- test/test.c ----------

with C=1 option, I get

test/test.c:7:21: error: incompatible types in comparison expression (different address spaces)

warning from

--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -605,7 +605,7 @@ static inline void rcu_preempt_sleep_check(void)
/* Dependency order vs. p above. */ \
typeof(*p) *________p1 = (typeof(*p) *__force)lockless_dereference(p); \
RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \
- rcu_dereference_sparse(p, space); \
+ rcu_dereference_sparse(p, space); /** this line **/ \
((typeof(*p) __force __kernel *)(________p1)); \
})
#define __rcu_dereference_protected(p, c, space) \

.

I want to use srcu_dereference() at
https://lists.01.org/pipermail/kbuild-all/2016-October/026587.html .
Can we have srcu version of 995f1405610bd844 ("rcu: Suppress sparse
warnings for rcu_dereference_raw()") ?

Regards.