[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f3393f50-02a8-4076-9129-6e8a1b8356f2@hartkopp.net>
Date: Thu, 27 Nov 2025 23:35:48 +0100
From: Oliver Hartkopp <socketcan@...tkopp.net>
To: Marc Kleine-Budde <mkl@...gutronix.de>
Cc: linux-can@...r.kernel.org, netdev@...r.kernel.org, davem@...emloft.net,
kuba@...nel.org, kernel@...gutronix.de, Vincent Mailhol <mailhol@...nel.org>
Subject: Re: [net-next] can: raw: fix build without CONFIG_CAN_DEV
On 27.11.25 23:22, Marc Kleine-Budde wrote:
> On 27.11.2025 22:07:10, Oliver Hartkopp wrote:
>> 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@...nel.org>
>> Signed-off-by: Oliver Hartkopp <socketcan@...tkopp.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.
>
> 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
>
Powered by blists - more mailing lists