]>
Commit | Line | Data |
---|---|---|
d996137a GKH |
1 | From foo@baz Wed Feb 28 16:19:30 CET 2018 |
2 | From: Luu An Phu <phu.luuan@nxp.com> | |
3 | Date: Tue, 2 Jan 2018 10:44:18 +0700 | |
4 | Subject: can: flex_can: Correct the checking for frame length in flexcan_start_xmit() | |
5 | ||
6 | From: Luu An Phu <phu.luuan@nxp.com> | |
7 | ||
8 | ||
9 | [ Upstream commit 13454c14550065fcc1705d6bd4ee6d40e057099f ] | |
10 | ||
11 | The flexcan_start_xmit() function compares the frame length with data | |
12 | register length to write frame content into data[0] and data[1] | |
13 | register. Data register length is 4 bytes and frame maximum length is 8 | |
14 | bytes. | |
15 | ||
16 | Fix the check that compares frame length with 3. Because the register | |
17 | length is 4. | |
18 | ||
19 | Signed-off-by: Luu An Phu <phu.luuan@nxp.com> | |
20 | Reviewed-by: Oliver Hartkopp <socketcan@hartkopp.net> | |
21 | Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> | |
22 | Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> | |
23 | Signed-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, ®s->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, ®s->mb[FLEXCAN_TX_BUF_ID].data[1]); | |
38 | } |