can: af_can: do not access proto_tab directly use rcu_access_pointer instead
authorMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 17 Oct 2017 05:18:35 +0000 (07:18 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 19 Oct 2017 11:05:53 +0000 (13:05 +0200)
commitcae1d5b78fb4874086170ad07921bca59ea2e893
tree81530dfc1b20ce28497e9a0187a0867c2f070c54
parent62c04647c6f44fa3d5d0c077133da0aa1cbbc34c
can: af_can: do not access proto_tab directly use rcu_access_pointer instead

"proto_tab" is a RCU protected array, when directly accessing the array,
sparse throws these warnings:

  CHECK   /srv/work/frogger/socketcan/linux/net/can/af_can.c
net/can/af_can.c:115:14: error: incompatible types in comparison expression (different address spaces)
net/can/af_can.c:795:17: error: incompatible types in comparison expression (different address spaces)
net/can/af_can.c:816:9: error: incompatible types in comparison expression (different address spaces)

This patch fixes the problem by using rcu_access_pointer() and
annotating "proto_tab" array as __rcu.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
net/can/af_can.c