diff mbox

[ovs-dev] ofproto: Fix using uninitialized delete_reason.

Message ID 1450943864-960-1-git-send-email-i.maximets@samsung.com
State Accepted
Headers show

Commit Message

Ilya Maximets Dec. 24, 2015, 7:57 a.m. UTC
replace_rule_finish() makes decision using uninitialized
for intrenal flow fm->delete_reason.
Reported by valgrind for test cases 886, 942 and 943.

 Conditional jump or move depends on uninitialised value(s)
    at rule_insert (ofproto-dpif.c:4134)
    by replace_rule_finish (ofproto.c:4831)
    by add_flow_finish (ofproto.c:4661)
    by modify_flows_finish (ofproto.c:4994)
    by ofproto_flow_mod_finish (ofproto.c:6821)
    by handle_flow_mod__ (ofproto.c:5323)
    by ofproto_dpif_add_internal_flow (ofproto-dpif.c:5680)
    by add_internal_miss_flow (ofproto-dpif.c:1385)
    by add_internal_flows (ofproto-dpif.c:1412)
    by construct (ofproto-dpif.c:1367)
    by ofproto_create (ofproto.c:577)
    by bridge_reconfigure (bridge.c:633)
    by bridge_run (bridge.c:2975)
    by main (ovs-vswitchd.c:120)
  Uninitialised value was created by a stack allocation
    at ofproto_dpif_add_internal_flow (ofproto-dpif.c:5658)

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 ofproto/ofproto-dpif.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ben Pfaff Jan. 4, 2016, 7:04 p.m. UTC | #1
On Thu, Dec 24, 2015 at 10:57:44AM +0300, Ilya Maximets wrote:
> replace_rule_finish() makes decision using uninitialized
> for intrenal flow fm->delete_reason.
> Reported by valgrind for test cases 886, 942 and 943.
> 
>  Conditional jump or move depends on uninitialised value(s)
>     at rule_insert (ofproto-dpif.c:4134)
>     by replace_rule_finish (ofproto.c:4831)
>     by add_flow_finish (ofproto.c:4661)
>     by modify_flows_finish (ofproto.c:4994)
>     by ofproto_flow_mod_finish (ofproto.c:6821)
>     by handle_flow_mod__ (ofproto.c:5323)
>     by ofproto_dpif_add_internal_flow (ofproto-dpif.c:5680)
>     by add_internal_miss_flow (ofproto-dpif.c:1385)
>     by add_internal_flows (ofproto-dpif.c:1412)
>     by construct (ofproto-dpif.c:1367)
>     by ofproto_create (ofproto.c:577)
>     by bridge_reconfigure (bridge.c:633)
>     by bridge_run (bridge.c:2975)
>     by main (ovs-vswitchd.c:120)
>   Uninitialised value was created by a stack allocation
>     at ofproto_dpif_add_internal_flow (ofproto-dpif.c:5658)
> 
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>

Thanks, applied to master and backported to branch-2.5 and branch-2.4.
diff mbox

Patch

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 6561c65..2f42886 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -5676,6 +5676,7 @@  ofproto_dpif_add_internal_flow(struct ofproto_dpif *ofproto,
     ofm.fm.flags = OFPUTIL_FF_HIDDEN_FIELDS | OFPUTIL_FF_NO_READONLY;
     ofm.fm.ofpacts = ofpacts->data;
     ofm.fm.ofpacts_len = ofpacts->size;
+    ofm.fm.delete_reason = OVS_OFPRR_NONE;
 
     error = ofproto_flow_mod(&ofproto->up, &ofm);
     if (error) {