[ovs-dev] [PATCH] odp-util: Fix alignment when scanning Geneve attributes.

Joe Stringer joestringer at nicira.com
Fri May 29 17:50:21 UTC 2015


On 29 May 2015 at 10:46, Jesse Gross <jesse at nicira.com> wrote:
> 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 at nicira.com>
> Signed-off-by: Jesse Gross <jesse at nicira.com>

Thanks, clang is happy now.

Acked-by: Joe Stringer <joestringer at nicira.com>



More information about the dev mailing list