odp-util: Fix alignment when scanning Geneve attributes.
authorJesse Gross <jesse@nicira.com>
Fri, 29 May 2015 17:41:05 +0000 (10:41 -0700)
committerJesse Gross <jesse@nicira.com>
Fri, 29 May 2015 17:52:57 +0000 (10:52 -0700)
commitc05c01cd86bdb26be1c107741c3ede2659e51a29
treeef2000c108371693a5562e68eb279c9b45d517f9
parent622a0a8e764d2b1fa6dd8b87f6b282baaac2a9d9
odp-util: Fix alignment when scanning Geneve attributes.

Clang complains about the fact that we use a byte array to scan
Geneve attributes into since there are different alignment requirements:

lib/odp-util.c:2936:30: error: cast from 'uint8_t *' (aka 'unsigned char *') to

      'struct geneve_opt *' increases required alignment from 1 to 2

      [-Werror,-Wcast-align]

    struct geneve_opt *opt = (struct geneve_opt *)key->d;

                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~

We can instead treat this as an array of Geneve option headers to
ensure we get the right alignment and then there are no need for
casts.

Reported-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
lib/odp-util.c