summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/flexcan.c
diff options
context:
space:
mode:
authorLuu An Phu <phu.luuan@nxp.com>2018-01-02 10:44:18 +0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-03 10:24:35 +0100
commit3f39cc7fe90b8f7fbf5ac700a29c416d8296b2fd (patch)
treeb7ebccc08925048784d149051d0305ac04b57ff9 /drivers/net/can/flexcan.c
parent0f258cc64f4ec4b933991fb24fa76deddc18fd92 (diff)
downloadlinux-stable-3f39cc7fe90b8f7fbf5ac700a29c416d8296b2fd.tar.gz
linux-stable-3f39cc7fe90b8f7fbf5ac700a29c416d8296b2fd.tar.bz2
linux-stable-3f39cc7fe90b8f7fbf5ac700a29c416d8296b2fd.zip
can: flex_can: Correct the checking for frame length in flexcan_start_xmit()
[ Upstream commit 13454c14550065fcc1705d6bd4ee6d40e057099f ] The flexcan_start_xmit() function compares the frame length with data register length to write frame content into data[0] and data[1] register. Data register length is 4 bytes and frame maximum length is 8 bytes. Fix the check that compares frame length with 3. Because the register length is 4. Signed-off-by: Luu An Phu <phu.luuan@nxp.com> Reviewed-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/can/flexcan.c')
-rw-r--r--drivers/net/can/flexcan.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index c4d1140116ea..ed8a2a7ce500 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -526,7 +526,7 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
data = be32_to_cpup((__be32 *)&cf->data[0]);
flexcan_write(data, &priv->tx_mb->data[0]);
}
- if (cf->can_dlc > 3) {
+ if (cf->can_dlc > 4) {
data = be32_to_cpup((__be32 *)&cf->data[4]);
flexcan_write(data, &priv->tx_mb->data[1]);
}