>From: [email protected] [mailto:[email protected]] 
>On Behalf Of
>Bhanuprakash Bodireddy
>Sent: Monday, June 19, 2017 7:54 PM
>To: [email protected]
>Subject: [ovs-dev] [PATCH 6/6] netdev: Fix null pointer dereference reported 
>by clang.
>
>Clang reports that array access from 'dumps' variable result in null pointer
>dereference.
>
>Signed-off-by: Bhanuprakash Bodireddy <[email protected]>

Hi Bhanu,

LGTM - I also compiled this with gcc, clang, and sparse without issue. 
Checkpatch reports no obvious problems either.

Acked-by: Mark Kavanagh <[email protected]>

One thing - what version of clang are you using? My version (3.4.2) didn't 
detect any of the issues in this patchset. Alternatively, are there additional 
flags that you use when compiling with clang?

Cheers,
Mark


>---
> lib/netdev.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
>diff --git a/lib/netdev.c b/lib/netdev.c
>index 001b7b3..336c141 100644
>--- a/lib/netdev.c
>+++ b/lib/netdev.c
>@@ -2290,14 +2290,16 @@ netdev_ports_flow_dump_create(const void *obj, int 
>*ports)
>
>     dumps = count ? xzalloc(sizeof *dumps * count) : NULL;
>
>-    HMAP_FOR_EACH(data, node, &port_to_netdev) {
>-        if (data->obj == obj) {
>-            if (netdev_flow_dump_create(data->netdev, &dumps[i])) {
>-                continue;
>-            }
>+    if (dumps) {
>+        HMAP_FOR_EACH(data, node, &port_to_netdev) {
>+            if (data->obj == obj) {
>+                if (netdev_flow_dump_create(data->netdev, &dumps[i])) {
>+                    continue;
>+                }
>
>-            dumps[i]->port = data->dpif_port.port_no;
>-            i++;
>+                dumps[i]->port = data->dpif_port.port_no;
>+                i++;
>+            }
>         }
>     }
>     ovs_mutex_unlock(&netdev_hmap_mutex);
>--
>2.4.11
>
>_______________________________________________
>dev mailing list
>[email protected]
>https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to