The test uses 16-bit ofp_port_t, however the struct flow member `in_port` is 32-bit, causing a memcpy to read uninitialized data. We should restrict the test to the `ofp_port` member of the `in_port` union
Signed-off-by: William Tu <[email protected]> Signed-off-by: Daniele Di Proietto <[email protected]> Co-authored-by: Daniele Di Proietto <[email protected]> --- tests/test-classifier.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/test-classifier.c b/tests/test-classifier.c index bd5a267..675d47d 100644 --- a/tests/test-classifier.c +++ b/tests/test-classifier.c @@ -49,23 +49,23 @@ static bool versioned = false; /* Fields in a rule. */ -#define CLS_FIELDS \ - /* struct flow all-caps */ \ - /* member name name */ \ - /* ----------- -------- */ \ - CLS_FIELD(tunnel.tun_id, TUN_ID) \ - CLS_FIELD(metadata, METADATA) \ - CLS_FIELD(nw_src, NW_SRC) \ - CLS_FIELD(nw_dst, NW_DST) \ - CLS_FIELD(in_port, IN_PORT) \ - CLS_FIELD(vlan_tci, VLAN_TCI) \ - CLS_FIELD(dl_type, DL_TYPE) \ - CLS_FIELD(tp_src, TP_SRC) \ - CLS_FIELD(tp_dst, TP_DST) \ - CLS_FIELD(dl_src, DL_SRC) \ - CLS_FIELD(dl_dst, DL_DST) \ - CLS_FIELD(nw_proto, NW_PROTO) \ - CLS_FIELD(nw_tos, NW_DSCP) +#define CLS_FIELDS \ + /* struct flow all-caps */ \ + /* member name name */ \ + /* ----------- -------- */ \ + CLS_FIELD(tunnel.tun_id, TUN_ID) \ + CLS_FIELD(metadata, METADATA) \ + CLS_FIELD(nw_src, NW_SRC) \ + CLS_FIELD(nw_dst, NW_DST) \ + CLS_FIELD(in_port.ofp_port, IN_PORT) \ + CLS_FIELD(vlan_tci, VLAN_TCI) \ + CLS_FIELD(dl_type, DL_TYPE) \ + CLS_FIELD(tp_src, TP_SRC) \ + CLS_FIELD(tp_dst, TP_DST) \ + CLS_FIELD(dl_src, DL_SRC) \ + CLS_FIELD(dl_dst, DL_DST) \ + CLS_FIELD(nw_proto, NW_PROTO) \ + CLS_FIELD(nw_tos, NW_DSCP) /* Field indexes. * -- 2.5.0 _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
