[ovs-dev] [PATCH] miniflow: Remove unused value_inline branch from miniflow_move()

Thomas Graf tgraf at noironetworks.com
Tue Aug 26 01:05:08 UTC 2014


The branch is unused as size < sizeof dst->inline_values must
always be true for inlined values. Hitting the branch would lead
to corruption as inline_values is accessed out of bounds.

Remove branch and add assertion.

Cc: Jarno Rajahalme <jrajahalme at nicira.com>
Signed-off-by: Thomas Graf <tgraf at noironetworks.com>
---
 lib/flow.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/flow.c b/lib/flow.c
index 29b331e..8620475 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -1726,12 +1726,9 @@ miniflow_move(struct miniflow *dst, struct miniflow *src)
         dst->values_inline = true;
         memcpy(dst->inline_values, miniflow_get_values(src), size);
         miniflow_destroy(src);
-    } else if (src->values_inline) {
-        dst->values_inline = false;
-        COVERAGE_INC(miniflow_malloc);
-        dst->offline_values = xmalloc(size);
-        memcpy(dst->offline_values, src->inline_values, size);
     } else {
+        ovs_assert(src->values_inline);
+
         dst->values_inline = false;
         dst->offline_values = src->offline_values;
     }
-- 
1.9.3




More information about the dev mailing list