netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: mcp251xfd: mcp251xfd_handle_ivmif(): fix wrong NULL pointer check
@ 2021-01-19  2:02 angkery
  2021-01-19  7:54 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: angkery @ 2021-01-19  2:02 UTC (permalink / raw)
  To: mkl, manivannan.sadhasivam, thomas.kopp, wg, davem, kuba
  Cc: linux-can, netdev, linux-kernel, Junlin Yang

From: Junlin Yang <yangjunlin@yulong.com>

if alloc_can_err_skb() returns NULL, we should check skb instead of cf.

Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
---
 drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
index f07e8b7..0af131c 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
@@ -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);
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] can: mcp251xfd: mcp251xfd_handle_ivmif(): fix wrong NULL pointer check
  2021-01-19  2:02 [PATCH] can: mcp251xfd: mcp251xfd_handle_ivmif(): fix wrong NULL pointer check angkery
@ 2021-01-19  7:54 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2021-01-19  7:54 UTC (permalink / raw)
  To: angkery, manivannan.sadhasivam, thomas.kopp, wg, davem, kuba
  Cc: linux-can, netdev, linux-kernel, Junlin Yang


[-- Attachment #1.1: Type: text/plain, Size: 742 bytes --]

On 1/19/21 3:02 AM, angkery wrote:
> From: Junlin Yang <yangjunlin@yulong.com>
> 
> 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

-- 
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 |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-19  7:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19  2:02 [PATCH] can: mcp251xfd: mcp251xfd_handle_ivmif(): fix wrong NULL pointer check angkery
2021-01-19  7:54 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).