The code in ofputil_decode_port_mod() was originally meant to mask the returned 'config' value against 'mask'. That is, only bits that are marked in 'mask' as to be modified can be set to 1-bits in the returned 'config' value; it doesn't really entirely make sense otherwise. The actual code to do this was dead, though. This fixes that problem.
In a quick skim of callers, I wasn't able to see an actual user-visible bug that this fixes. Found by Coverity. Reported-at: https://scan3.coverity.com/reports.htm#v16889/p10449/fileInstanceId=14762682&defectInstanceId=4304822&mergedDefectId=180422 Signed-off-by: Ben Pfaff <b...@ovn.org> --- lib/ofp-util.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 073b49b5404a..67512af8aee6 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -5153,20 +5153,22 @@ ofputil_decode_port_mod(const struct ofp_header *oh, struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length)); enum ofpraw raw = ofpraw_pull_assert(&b); + + enum ofperr error; if (raw == OFPRAW_OFPT10_PORT_MOD) { - return ofputil_decode_ofp10_port_mod(b.data, pm); + error = ofputil_decode_ofp10_port_mod(b.data, pm); } else if (raw == OFPRAW_OFPT11_PORT_MOD) { - return ofputil_decode_ofp11_port_mod(b.data, pm); + error = ofputil_decode_ofp11_port_mod(b.data, pm); } else if (raw == OFPRAW_OFPT14_PORT_MOD) { - return ofputil_decode_ofp14_port_mod(&b, loose, pm); + error = ofputil_decode_ofp14_port_mod(&b, loose, pm); } else if (raw == OFPRAW_OFPT16_PORT_MOD) { - return ofputil_decode_ofp16_port_mod(&b, loose, pm); + error = ofputil_decode_ofp16_port_mod(&b, loose, pm); } else { - return OFPERR_OFPBRC_BAD_TYPE; + error = OFPERR_OFPBRC_BAD_TYPE; } pm->config &= pm->mask; - return 0; + return error; } /* Converts the abstract form of a "port mod" message in '*pm' into an OpenFlow -- 2.10.2 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev