On 25.02.2021 22:51:54, Dario Binacchi wrote:
> --- a/drivers/net/can/c_can/c_can.c
> +++ b/drivers/net/can/c_can/c_can.c
[...]
> -struct net_device *alloc_c_can_dev(void)
> +struct net_device *alloc_c_can_dev(int msg_obj_num)
>  {
>       struct net_device *dev;
>       struct c_can_priv *priv;
> +     int msg_obj_tx_num = msg_obj_num / 2;
>  
> -     dev = alloc_candev(sizeof(struct c_can_priv), C_CAN_MSG_OBJ_TX_NUM);
> +     dev = alloc_candev(sizeof(*priv) + sizeof(u32) * msg_obj_tx_num,
> +                        msg_obj_tx_num);
>       if (!dev)
>               return NULL;
>  
>       priv = netdev_priv(dev);
> -     netif_napi_add(dev, &priv->napi, c_can_poll, C_CAN_NAPI_WEIGHT);
> +     priv->msg_obj_num = msg_obj_num;
> +     priv->msg_obj_rx_num = msg_obj_num - msg_obj_tx_num;
> +     priv->msg_obj_rx_first = 1;
> +     priv->msg_obj_rx_last =
> +             priv->msg_obj_rx_first + priv->msg_obj_rx_num - 1;
> +     priv->msg_obj_rx_mask = ((u64)1 << priv->msg_obj_rx_num) - 1;

Here you're casting the 1 to 64bit, but msg_obj_rx_mask is only u32. Use
"1UL", if you are sure that rx_mask would never exceed 32 bit.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Attachment: signature.asc
Description: PGP signature

Reply via email to