]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.120/can-flex_can-correct-the-checking-for-frame-length-in-flexcan_start_xmit.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.120 / can-flex_can-correct-the-checking-for-frame-length-in-flexcan_start_xmit.patch
CommitLineData
d996137a
GKH
1From foo@baz Wed Feb 28 16:19:30 CET 2018
2From: Luu An Phu <phu.luuan@nxp.com>
3Date: Tue, 2 Jan 2018 10:44:18 +0700
4Subject: can: flex_can: Correct the checking for frame length in flexcan_start_xmit()
5
6From: Luu An Phu <phu.luuan@nxp.com>
7
8
9[ Upstream commit 13454c14550065fcc1705d6bd4ee6d40e057099f ]
10
11The flexcan_start_xmit() function compares the frame length with data
12register length to write frame content into data[0] and data[1]
13register. Data register length is 4 bytes and frame maximum length is 8
14bytes.
15
16Fix the check that compares frame length with 3. Because the register
17length is 4.
18
19Signed-off-by: Luu An Phu <phu.luuan@nxp.com>
20Reviewed-by: Oliver Hartkopp <socketcan@hartkopp.net>
21Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
22Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
23Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24---
25 drivers/net/can/flexcan.c | 2 +-
26 1 file changed, 1 insertion(+), 1 deletion(-)
27
28--- a/drivers/net/can/flexcan.c
29+++ b/drivers/net/can/flexcan.c
30@@ -493,7 +493,7 @@ static int flexcan_start_xmit(struct sk_
31 data = be32_to_cpup((__be32 *)&cf->data[0]);
32 flexcan_write(data, &regs->mb[FLEXCAN_TX_BUF_ID].data[0]);
33 }
34- if (cf->can_dlc > 3) {
35+ if (cf->can_dlc > 4) {
36 data = be32_to_cpup((__be32 *)&cf->data[4]);
37 flexcan_write(data, &regs->mb[FLEXCAN_TX_BUF_ID].data[1]);
38 }