]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
cdcf8302904f26917f6ed79ad075d9aba55903c7
[thirdparty/kernel/stable-queue.git] /
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
5
6 From: Marc Kleine-Budde <mkl@pengutronix.de>
7
8 commit 200f5c49f7a2cd694436bfc6cb0662b794c96736 upstream.
9
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
14 comment.
15
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>
19
20 ---
21 drivers/net/can/dev.c | 9 ++++++---
22 1 file changed, 6 insertions(+), 3 deletions(-)
23
24 --- a/drivers/net/can/dev.c
25 +++ b/drivers/net/can/dev.c
26 @@ -484,11 +484,14 @@ struct sk_buff *__can_get_echo_skb(struc
27 BUG_ON(idx >= priv->echo_skb_max);
28
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.
32 + */
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;
37 + u8 len = cf->len;
38
39 - *len_ptr = dlc;
40 + *len_ptr = len;
41 priv->echo_skb[idx] = NULL;
42
43 return skb;