All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2]net: null check after pointer dereference
@ 2016-01-29 15:45 Vishwas Srivastava
  2016-02-06 15:40 ` [U-Boot] [PATCH v3] net: davinci_emac: fix NULL " Anatolij Gustschin
  0 siblings, 1 reply; 3+ messages in thread
From: Vishwas Srivastava @ 2016-01-29 15:45 UTC (permalink / raw)
  To: u-boot

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 in
davinci-emac driver. This patch fixes this issue.

Signed-off-by: Vishwas Srivastava <vishu.kernel@gmail.com>
CC: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

Changes for v2:
        -cleaned up the style format
        -addressed various comments given by Joe <joe.hershberger@ni.com>
        on the first version of the patch.

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 3f54a3f..a61374d 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 Thu, Jan 28, 2016 at 1:35 AM, Joe Hershberger <joe.hershberger@gmail.com>
wrote:

> 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 at 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
>

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH v3] net: davinci_emac: fix NULL check after pointer dereference
  2016-01-29 15:45 [U-Boot] [PATCH v2]net: null check after pointer dereference Vishwas Srivastava
@ 2016-02-06 15:40 ` Anatolij Gustschin
  2016-02-06 15:46   ` Anatolij Gustschin
  0 siblings, 1 reply; 3+ messages in thread
From: Anatolij Gustschin @ 2016-02-06 15:40 UTC (permalink / raw)
  To: u-boot

From: Vishwas Srivastava <vishu.kernel@gmail.com>

NULL check is made after the pointer dereference. This patch
fixes this issue.

Signed-off-by: Vishwas Srivastava <vishu.kernel@gmail.com>
CC: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Anatolij Gustschin <agust@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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH v3] net: davinci_emac: fix NULL check after pointer dereference
  2016-02-06 15:40 ` [U-Boot] [PATCH v3] net: davinci_emac: fix NULL " Anatolij Gustschin
@ 2016-02-06 15:46   ` Anatolij Gustschin
  0 siblings, 0 replies; 3+ messages in thread
From: Anatolij Gustschin @ 2016-02-06 15:46 UTC (permalink / raw)
  To: u-boot

On Sat,  6 Feb 2016 16:40:59 +0100
Anatolij Gustschin agust at denx.de wrote:

> From: Vishwas Srivastava <vishu.kernel@gmail.com>
> 
> NULL check is made after the pointer dereference. This patch
> fixes this issue.
> 
> Signed-off-by: Vishwas Srivastava <vishu.kernel@gmail.com>
> CC: Joe Hershberger <joe.hershberger@ni.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> Signed-off-by: Anatolij Gustschin <agust@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(-)

Applied to u-boot-staging, thanks!

--
Anatolij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-06 15:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-29 15:45 [U-Boot] [PATCH v2]net: null check after pointer dereference Vishwas Srivastava
2016-02-06 15:40 ` [U-Boot] [PATCH v3] net: davinci_emac: fix NULL " Anatolij Gustschin
2016-02-06 15:46   ` Anatolij Gustschin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.