Skip to content

Commit eece712

Browse files
hzhou8almusil
authored andcommitted
ovn-trace: Fix pop action in trace.
The pop action execution in trace may print garbage data due to uninitialized buffer. For example, when it is supposed to print: pop(reg2) <- 0x50; it could print: pop(reg2) <- 0xf8a720000000000060f9000000000000306d572fff7f000032fc466a30560000e06d572fff7f0000f831461c5d7f0000506d572fff7f0000fcf2476a305600001800000000000000f831461c5d7f0000906d572fff7f000079fa476a305600000000000000000000e06d572fff7f00001800000000000000f831461c00000050; The actual value is the at the 0x50 at the tail but it prints the whole 128 byte buffer. This patch fixes it. Fixes: 8ce8477 ("actions: Add stack push and pop actions.") Signed-off-by: Han Zhou <hzhou@ovn.org> Signed-off-by: Ales Musil <amusil@redhat.com> (cherry picked from commit 543631a)
1 parent 37f0b27 commit eece712

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

utilities/ovn-trace.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,12 +1609,8 @@ execute_pop(const struct ovnact_push_pop *p, struct ofpbuf *stack,
16091609
const void *src = nx_stack_pop(stack, &src_bytes);
16101610
if (src) {
16111611
union mf_subvalue sv;
1612-
uint8_t dst_bytes = DIV_ROUND_UP(sf.n_bits, 8);
1612+
memset(&sv, 0, sizeof sv);
16131613

1614-
if (src_bytes < dst_bytes) {
1615-
memset(&sv.u8[sizeof sv - dst_bytes], 0,
1616-
dst_bytes - src_bytes);
1617-
}
16181614
memcpy(&sv.u8[sizeof sv - src_bytes], src, src_bytes);
16191615
mf_write_subfield_flow(&sf, &sv, uflow);
16201616
mf_format_subvalue(&sv, &s);

0 commit comments

Comments
 (0)