summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/spi
diff options
context:
space:
mode:
authorQinglang Miao <miaoqinglang@huawei.com>2021-01-13 08:31:00 +0100
committerMarc Kleine-Budde <mkl@pengutronix.de>2021-01-13 22:16:16 +0100
commitca4c6ebeeb50112f5178f14bfb6d9e8ddf148545 (patch)
treebc8dc1ff72f6ae18831f4cbf0062f523788e5fb5 /drivers/net/can/spi
parentcan: isotp: isotp_getname(): fix kernel information leak (diff)
downloadlinux-ca4c6ebeeb50112f5178f14bfb6d9e8ddf148545.tar.xz
linux-ca4c6ebeeb50112f5178f14bfb6d9e8ddf148545.zip
can: mcp251xfd: mcp251xfd_handle_rxif_one(): fix wrong NULL pointer check
If alloc_canfd_skb() returns NULL, 'cfg' is an uninitialized variable, so we should check 'skb' rather than 'cfd' after calling alloc_canfd_skb(priv->ndev, &cfd). Fixes: 55e5b97f003e ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN") Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/20210113073100.79552-1-miaoqinglang@huawei.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/spi')
-rw-r--r--drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
index 36235afb0bc6..f07e8b737d31 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
@@ -1491,7 +1491,7 @@ mcp251xfd_handle_rxif_one(struct mcp251xfd_priv *priv,
else
skb = alloc_can_skb(priv->ndev, (struct can_frame **)&cfd);
- if (!cfd) {
+ if (!skb) {
stats->rx_dropped++;
return 0;
}