can: mcp251xfd: mcp251xfd_handle_ivmif(): fix wrong NULL pointer check
PATCH 1/1 can: mcp251xfd: mcp251xfd_handle_ivmif(): fix wrong NULL pointer check
From: Junlin Yang <[email protected]>
if alloc_can_err_skb() returns NULL, we should check skb instead of cf.
Signed-off-by Junlin Yang <[email protected]>
--- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +1 -1
@@ -1755,7 +1755,7 @@ static int mcp251xfd_handle_ivmif(struct mcp251xfd_priv *priv) cf->data[2 ] |=CAN_ERR_PROT_TX |CAN_ERR_PROT_BIT0 ; } -if (!cf) +if (!skb)return 0 ; err =can_rx_offload_queue_sorted (&priv->offload, skb, timestamp);
Signature · 1 line
1.9.1
Marc Kleine-Budde
maintainerQuoted 3 lines · angkery
From: Junlin Yang <[email protected]>
if
alloc_can_err_skb()returns NULL, we should check skb instead of cf.
Have a look at the function, there is a check for cf several times before this. But as cf is initialized as NULL this is should be no problem.
While in:
| ca4c6ebeeb50 can: mcp251xfd: mcp251xfd_handle_rxif_one():
| fix wrong NULL pointer check
a real problem has been fixed.
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |