Skip to content

Commit

Permalink
miniflow: Remove unused values_inline branch from miniflow_move()
Browse files Browse the repository at this point in the history
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@nicira.com>
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
  • Loading branch information
Thomas Graf authored and blp committed Aug 26, 2014
1 parent 83c88c2 commit 29d2aa3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/flow.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 29d2aa3

Please sign in to comment.