Thread (6 messages) 6 messages, 2 authors, 2025-11-27

Re: [net-next] can: raw: fix build without CONFIG_CAN_DEV

From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: 2025-11-27 22:36:15
Also in: linux-can


On 27.11.25 23:22, Marc Kleine-Budde wrote:
On 27.11.2025 22:07:10, Oliver Hartkopp wrote:
quoted
The feature to instantly reject unsupported CAN frames makes use of CAN
netdevice specific flags which are only accessible when the CAN device
driver infrastructure is built.

Therefore check for CONFIG_CAN_DEV and fall back to MTU testing when the
CAN device driver infrastructure is absent.

Fixes: 1a620a723853 ("can: raw: instantly reject unsupported CAN frames")
Reported-by: Vincent Mailhol <mailhol@kernel.org>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
That's not sufficient. We can build the CAN_DEV as a module but compile
CAN_RAW into the kernel.
Oh, yes that's better.

I had a fight with CONFIG_CAN_DEV with my first patch too.
That's why I sent a v2 some seconds ago.
quoted hunk ↗ jump to hunk
This patch does the same as your's but only with a single ifdef in the
header file.
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 52c8be5c160e..14d58461430e 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -111,7 +111,14 @@ struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max,
  void free_candev(struct net_device *dev);

  /* a candev safe wrapper around netdev_priv */
+#ifdef CONFIG_CAN_DEV
  struct can_priv *safe_candev_priv(struct net_device *dev);
+#else
+static inline struct can_priv *safe_candev_priv(struct net_device *dev)
+{
+        return NULL;
+}
+#endif
Will send a v3 with your suggestion.

Many thanks,
Oliver
  int open_candev(struct net_device *dev);
  void close_candev(struct net_device *dev);

Marc
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help