From: Justin Pettit Date: Tue, 30 Sep 2008 21:19:47 +0000 (-0700) Subject: Properly allocate flow action blocks in user-space switch. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=650e15903c7baadc65a4a5a7773b6c1a5013fac4;p=openvswitch Properly allocate flow action blocks in user-space switch. The user-space switch was allocating blocks to hold actions in flows that did not include the action header. --- diff --git a/switch/switch-flow.c b/switch/switch-flow.c index a42d00fb..133e4f89 100644 --- a/switch/switch-flow.c +++ b/switch/switch-flow.c @@ -173,11 +173,12 @@ struct sw_flow * flow_alloc(int n_actions) { struct sw_flow_actions *sfa; + size_t size = sizeof *sfa + (n_actions * sizeof sfa->actions[0]); struct sw_flow *flow = malloc(sizeof *flow); if (!flow) return NULL; - sfa = malloc(n_actions * sizeof sfa->actions[0]); + sfa = malloc(size); if (!sfa) { free(flow); return NULL;