From: Simon Horman Date: Wed, 7 Nov 2012 08:02:59 +0000 (+0900) Subject: ofp-util: Correct length of hello version bitmap X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74c4b9c1c24b6579dcaa127268530af9bffa29b4;p=openvswitch ofp-util: Correct length of hello version bitmap The length of the hello version bitmap is measured in bytes so the return value of sizeof is sufficient. Dividing this by CHAR_BIT (=8) seems to be an artifact of reworking a previous version of this code. Signed-off-by: Simon Horman Signed-off-by: Ben Pfaff --- diff --git a/lib/ofp-util.c b/lib/ofp-util.c index ae54477e..5703f8cc 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -1181,7 +1181,7 @@ ofputil_encode_hello(uint32_t allowed_versions) struct ofp_hello_elem_header *oheh; uint16_t map_len; - map_len = sizeof(uint32_t) / CHAR_BIT; + map_len = sizeof allowed_versions; oheh = ofpbuf_put_zeros(msg, ROUND_UP(map_len + sizeof *oheh, 8)); oheh->type = htons(OFPHET_VERSIONBITMAP); oheh->length = htons(map_len + sizeof *oheh);