Skip to content

Commit fd21e00

Browse files
Qinglang Miaogregkh
Qinglang Miao
authored andcommitted
can: mcp251xfd: mcp251xfd_handle_rxif_one(): fix wrong NULL pointer check
[ Upstream commit ca4c6eb ] 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: 55e5b97 ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN") Signed-off-by: Qinglang Miao <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Kleine-Budde <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 65accf0 commit fd21e00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@ mcp251xfd_handle_rxif_one(struct mcp251xfd_priv *priv,
14321432
else
14331433
skb = alloc_can_skb(priv->ndev, (struct can_frame **)&cfd);
14341434

1435-
if (!cfd) {
1435+
if (!skb) {
14361436
stats->rx_dropped++;
14371437
return 0;
14381438
}

0 commit comments

Comments
 (0)