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

Maxim Uvarov maxim.uvarov at linaro.org
Mon Dec 4 13:04:39 CET 2023


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;
+
 	if (ntohs(eth->et_protlen) != PROT_ARP)
 		return -EAGAIN;
 
-- 
2.30.2



More information about the U-Boot mailing list