Skip to contentSkip to conversation

net : null check after pointer dereference

PATCH Superseded Vishwas Srivastava 3 participants 4 messages Jan 26, 2016 – Jan 27, 2016 Network drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net : null check after pointer dereference

Author: Vishwas Srivastava <[email protected]>
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 <[email protected]>;Joe Hershberger <
[email protected]>

drivers/net/davinci_emac.c +0 -0
index 3f54a3f..1966eb9 100644
@@ -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 lore raw

PATCH 1/1 net : null check after pointer dereference

drivers/net/davinci_emac.c

Quoted 14 lines · Vishwas Srivastava
Author: Vishwas Srivastava <[email protected]>
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 <[email protected]>;Joe Hershberger <
joe.hershberger at ni.com>

drivers/net/davinci_emac.c +0 -0
index 3f54a3f..1966eb9 100644
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160126/09e4593c/attachment.sig>
#2 lore raw

PATCH 1/1 net : null check after pointer dereference

In reply to Vishwas Srivastava
Quoted 11 lines · Vishwas Srivastava
Author: Vishwas Srivastava <[email protected]>
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 <[email protected]>;Joe Hershberger <
joe.hershberger at ni.com>

#3 lore raw

PATCH 1/1 net : null check after pointer dereference

In reply to Vishwas Srivastava
Quoted 2 lines · Vishwas Srivastava
Author: Vishwas Srivastava <[email protected]>
Date:   Tue Jan 26 12:46:42 2016 +0530

Please fix the subject of this patch. No space in the "net :".

Quoted 2 lines

null check after pointer dereference

All of your commit logs should not have spaces in them (at the start of lines).

Quoted 6 lines

NULL check is made after the pointer dereference is davinci- emac driver. This patch fixes this issue.

CC: Sergey Kubushyn <[email protected]>;Joe Hershberger <
joe.hershberger at ni.com>

Fix this format. One "Cc:" per line.

Quoted 1 line

This belongs first... before the Cc:

drivers/net/davinci_emac.c static int davinci_eth_rcv_packet (struct eth_device · line 695

Quoted 10 lines
drivers/net/davinci_emac.c +0 -0
index 3f54a3f..1966eb9 100644
@@ -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.

Quoted 8 lines
drivers/net/davinci_emac.c +3 -1
+       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