X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fodp-util.c;h=751c1c92390dea32cdfd0b939137ac6b754e9dec;hb=4d5f814dfb737aae820b8ce70ff0a8b94c291ec3;hp=f9e9321bad8f7c05a0d1a73aa4628cf3c93bde0c;hpb=1b035ef20084e14b90537fb3873af99f45d40e34;p=sliver-openvswitch.git diff --git a/lib/odp-util.c b/lib/odp-util.c index f9e9321ba..751c1c923 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -1714,6 +1714,7 @@ parse_flow_nlattrs(const struct nlattr *key, size_t key_len, uint64_t present_attrs; size_t left; + BUILD_ASSERT(OVS_KEY_ATTR_MAX < CHAR_BIT * sizeof present_attrs); present_attrs = 0; *out_of_range_attrp = 0; NL_ATTR_FOR_EACH (nla, left, key, key_len) { @@ -1728,7 +1729,7 @@ parse_flow_nlattrs(const struct nlattr *key, size_t key_len, return false; } - if (type >= CHAR_BIT * sizeof present_attrs) { + if (type > OVS_KEY_ATTR_MAX) { *out_of_range_attrp = type; } else { if (present_attrs & (UINT64_C(1) << type)) {