1 From 200f5c49f7a2cd694436bfc6cb0662b794c96736 Mon Sep 17 00:00:00 2001
2 From: Marc Kleine-Budde <mkl@pengutronix.de>
3 Date: Wed, 31 Oct 2018 11:08:21 +0100
4 Subject: can: dev: __can_get_echo_skb(): replace struct can_frame by canfd_frame to access frame length
6 From: Marc Kleine-Budde <mkl@pengutronix.de>
8 commit 200f5c49f7a2cd694436bfc6cb0662b794c96736 upstream.
10 This patch replaces the use of "struct can_frame::can_dlc" by "struct
11 canfd_frame::len" to access the frame's length. As it is ensured that
12 both structures have a compatible memory layout for this member this is
13 no functional change. Futher, this compatibility is documented in a
16 Cc: linux-stable <stable@vger.kernel.org>
17 Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 drivers/net/can/dev.c | 9 ++++++---
22 1 file changed, 6 insertions(+), 3 deletions(-)
24 --- a/drivers/net/can/dev.c
25 +++ b/drivers/net/can/dev.c
26 @@ -460,11 +460,14 @@ struct sk_buff *__can_get_echo_skb(struc
27 BUG_ON(idx >= priv->echo_skb_max);
29 if (priv->echo_skb[idx]) {
30 + /* Using "struct canfd_frame::len" for the frame
31 + * length is supported on both CAN and CANFD frames.
33 struct sk_buff *skb = priv->echo_skb[idx];
34 - struct can_frame *cf = (struct can_frame *)skb->data;
35 - u8 dlc = cf->can_dlc;
36 + struct canfd_frame *cf = (struct canfd_frame *)skb->data;
41 priv->echo_skb[idx] = NULL;