[PATHv2 2/9] net: sandbox: fix NULL pointer derefences

Sean Anderson seanga2 at gmail.com
Mon Dec 25 23:43:45 CET 2023


On 12/25/23 10:39, Maxim Uvarov wrote:
> Add additional checks for NULL pointers.
> 
> Signed-off-by: Maxim Uvarov <maxim.uvarov at linaro.org>
> ---
>   drivers/net/sandbox.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/sandbox.c b/drivers/net/sandbox.c
> index 13022addb6..d91935e032 100644
> --- a/drivers/net/sandbox.c
> +++ b/drivers/net/sandbox.c
> @@ -65,6 +65,9 @@ int sandbox_eth_arp_req_to_reply(struct udevice *dev, void *packet,
>   	struct ethernet_hdr *eth_recv;
>   	struct arp_hdr *arp_recv;
>   
> +	if (!priv)
> +		return -EAGAIN;
> +

When can priv be NULL?

--Sean

>   	if (ntohs(eth->et_protlen) != PROT_ARP)
>   		return -EAGAIN;
>   



More information about the U-Boot mailing list