From 74c4b9c1c24b6579dcaa127268530af9bffa29b4 Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Wed, 7 Nov 2012 17:02:59 +0900 Subject: [PATCH] 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 --- lib/ofp-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.30.2