dpll: fix build failure due to rcu_dereference_check() on unknown type
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 dpll: fix build failure due to rcu_dereference_check() on unknown type
From: Eric Dumazet <[email protected]>
Tasmiya reports that their compiler complains that we deref a pointer to unknown type with rcu_dereference_rtnl():
include/linux/rcupdate.h:439:9: error: dereferencing pointer to incomplete type ‘struct dpll_pin’
Unclear what compiler it is, at the moment, and we can't report but since DPLL can't be a module - move the code from the header into the source file.
---
Sending officially the solution Eric suggested in the report thread. The bug is pending in the net tree, so I'd like to put this on an express path, to make today's PR...
--- drivers/dpll/dpll_core.c | 5 +++++ include/linux/dpll.h | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-)
drivers/dpll/dpll_core.c +5 -0
@@ -42,6 +42,11 @@ struct dpll_pin_registration {void *priv; }; +struct dpll_pin *netdev_dpll_pin (const struct net_device *dev) +{ +return rcu_dereference_rtnl (dev->dpll_pin); +} +struct dpll_device *dpll_device_get_by_id (int id) {if (xa_get_mark (&dpll_device_xa, id,DPLL_REGISTERED ))
include/linux/dpll.h +4 -4
@@ -169,13 +169,13 @@ int dpll_device_change_ntf(struct dpll_device *dpll);int dpll_pin_change_ntf (struct dpll_pin *pin); +#if !IS_ENABLED (CONFIG_DPLL )static inline struct dpll_pin *netdev_dpll_pin (const struct net_device *dev) { -#if IS_ENABLED (CONFIG_DPLL ) -return rcu_dereference_rtnl (dev->dpll_pin); -#else return NULL ; -#endif } +#else +struct dpll_pin *netdev_dpll_pin (const struct net_device *dev); +#endif #endif
Signature · 1 line
2.43.2
Quoted 57 lines · Jakub Kicinski
From: Eric Dumazet <[email protected]>
Tasmiya reports that their compiler complains that we deref a pointer to unknown type with
rcu_dereference_rtnl():
include/linux/rcupdate.h:439:9: error: dereferencing pointer to incomplete type ‘struct dpll_pin’Unclear what compiler it is, at the moment, and we can't report but since DPLL can't be a module - move the code from the header into the source file.
Fixes 0d60d8df6f49 ("dpll: rely on rcu for netdev_dpll_pin()")Reported-by Tasmiya Nalatwad <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>---
Sending officially the solution Eric suggested in the report thread. The bug is pending in the net tree, so I'd like to put this on an express path, to make today's PR...--- drivers/dpll/dpll_core.c | 5 +++++ include/linux/dpll.h | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-)drivers/dpll/dpll_core.c +5
-0@@ -42,6 +42,11 @@ struct dpll_pin_registration {void *priv; }; +struct dpll_pin *netdev_dpll_pin (const struct net_device *dev) +{ +return rcu_dereference_rtnl (dev->dpll_pin); +} +struct dpll_device *dpll_device_get_by_id (int id) {if (xa_get_mark (&dpll_device_xa, id,DPLL_REGISTERED ))include/linux/dpll.h +1
-1@@ -169,13 +169,13 @@ int dpll_device_change_ntf(struct dpll_device *dpll);int dpll_pin_change_ntf (struct dpll_pin *pin); +#if !IS_ENABLED (CONFIG_DPLL )static inline struct dpll_pin *netdev_dpll_pin (const struct net_device *dev) { -#if IS_ENABLED (CONFIG_DPLL )
include/linux/dpll.h int dpll_device_change_ntf(struct dpll_device *dpll); · line 181
Quoted 10 lines
include/linux/dpll.h +3
-3-return rcu_dereference_rtnl (dev->dpll_pin); -#else return NULL ; -#endif } +#else +struct dpll_pin *netdev_dpll_pin (const struct net_device *dev); +#endif #endif
That also works (as well as void *),
Quoted 10 lines · On Thu, 29 Feb 2024 11:05:15 -0800 Jakub Kicinski wrote:
From: Eric Dumazet <[email protected]>
Tasmiya reports that their compiler complains that we deref a pointer to unknown type with
rcu_dereference_rtnl():
include/linux/rcupdate.h:439:9: error: dereferencing pointer to incomplete type ‘struct dpll_pin’Unclear what compiler it is, at the moment, and we can't report but since DPLL can't be a module - move the code from the header into the source file.
Applied, and pushed for the PR..