[U-Boot] [PATCH] net : null check after pointer dereference

Author: Vishwas Srivastava vishu.kernel@gmail.com Date: Tue Jan 26 12:46:42 2016 +0530
null check after pointer dereference
NULL check is made after the pointer dereference is davinci- emac driver. This patch fixes this issue.
CC: Sergey Kubushyn ksi@koi8.net;Joe Hershberger < joe.hershberger@ni.com> Signed-off-by: Vishwas Srivastava vishu.kernel@gmail.com
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 3f54a3f..1966eb9 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");

On Tue, Jan 26, 2016 at 12:56:09PM +0530, Vishwas Srivastava wrote:
Author: Vishwas Srivastava vishu.kernel@gmail.com Date: Tue Jan 26 12:46:42 2016 +0530
null check after pointer dereference NULL check is made after the pointer dereference is davinci- emac driver. This patch fixes this issue. CC: Sergey Kubushyn <ksi@koi8.net>;Joe Hershberger <
joe.hershberger@ni.com> Signed-off-by: Vishwas Srivastava vishu.kernel@gmail.com
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 3f54a3f..1966eb9 100644
Reviewed-by: Tom Rini trini@konsulko.com

On Tue, Jan 26, 2016 at 1:26 AM, Vishwas Srivastava vishu.kernel@gmail.com wrote:
Author: Vishwas Srivastava vishu.kernel@gmail.com Date: Tue Jan 26 12:46:42 2016 +0530
null check after pointer dereference NULL check is made after the pointer dereference is davinci- emac driver. This patch fixes this issue. CC: Sergey Kubushyn <ksi@koi8.net>;Joe Hershberger <
joe.hershberger@ni.com> Signed-off-by: Vishwas Srivastava vishu.kernel@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

On Tue, Jan 26, 2016 at 1:26 AM, Vishwas Srivastava vishu.kernel@gmail.com wrote:
Author: Vishwas Srivastava vishu.kernel@gmail.com Date: Tue Jan 26 12:46:42 2016 +0530
Please fix the subject of this patch. No space in the "net :".
null check after pointer dereference
All of your commit logs should not have spaces in them (at the start of lines).
NULL check is made after the pointer dereference is davinci- emac driver. This patch fixes this issue. CC: Sergey Kubushyn <ksi@koi8.net>;Joe Hershberger <
joe.hershberger@ni.com>
Fix this format. One "Cc:" per line.
Signed-off-by: Vishwas Srivastava <vishu.kernel@gmail.com>
This belongs first... before the Cc:
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 3f54a3f..1966eb9 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;
You need to run your patches through scripts/checkpatch.pl.
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");
Consider using tools/patman.
Thanks, -Joe
participants (3)
-
Joe Hershberger
-
Tom Rini
-
Vishwas Srivastava