can: Before we use pstate, we should check if it is NULL.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
dedb4c95c9
commit
e1b9144e71
@ -369,14 +369,15 @@ static uint16_t can_recvfrom_eventhandler(FAR struct net_driver_s *dev,
|
||||
FAR void *pvpriv, uint16_t flags)
|
||||
{
|
||||
struct can_recvfrom_s *pstate = pvpriv;
|
||||
#if defined(CONFIG_NET_CANPROTO_OPTIONS) || defined(CONFIG_NET_TIMESTAMP)
|
||||
struct can_conn_s *conn = pstate->pr_conn;
|
||||
#endif
|
||||
|
||||
/* 'priv' might be null in some race conditions (?) */
|
||||
|
||||
if (pstate)
|
||||
{
|
||||
#if defined(CONFIG_NET_CANPROTO_OPTIONS) || defined(CONFIG_NET_TIMESTAMP)
|
||||
struct can_conn_s *conn = pstate->pr_conn;
|
||||
#endif
|
||||
|
||||
if ((flags & CAN_NEWDATA) != 0)
|
||||
{
|
||||
/* If a new packet is available, check receive filters
|
||||
|
Loading…
x
Reference in New Issue
Block a user