[U-Boot] [PATCH v3] net: davinci_emac: fix NULL check after pointer dereference
Anatolij Gustschin
agust at denx.de
Sat Feb 6 16:40:59 CET 2016
From: Vishwas Srivastava <vishu.kernel at gmail.com>
NULL check is made after the pointer dereference. This patch
fixes this issue.
Signed-off-by: Vishwas Srivastava <vishu.kernel at gmail.com>
CC: Joe Hershberger <joe.hershberger at ni.com>
Reviewed-by: Tom Rini <trini at konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger at ni.com>
Signed-off-by: Anatolij Gustschin <agust at denx.de>
---
Changes in v3:
- slightly edit subject and commit message
- format patch properly
drivers/net/davinci_emac.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 6f2dc8d..b030498 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -692,8 +692,10 @@ static int davinci_eth_rcv_packet (struct eth_device *dev)
davinci_invalidate_rx_descs();
rx_curr_desc = emac_rx_active_head;
+ if (!rx_curr_desc)
+ return 0;
status = rx_curr_desc->pkt_flag_len;
- if ((rx_curr_desc) && ((status & EMAC_CPPI_OWNERSHIP_BIT) == 0)) {
+ if ((status & EMAC_CPPI_OWNERSHIP_BIT) == 0) {
if (status & EMAC_CPPI_RX_ERROR_FRAME) {
/* Error in packet - discard it and requeue desc */
printf ("WARN: emac_rcv_pkt: Error in packet\n");
--
1.7.9.5
More information about the U-Boot
mailing list