mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 14:44:10 +08:00
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: 55e5b97f00
("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>
This commit is contained in:
parent
b42b3a2744
commit
ca4c6ebeeb
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user