On Mon, Sep 17, 2018 at 10:01 PM Ben Pfaff <b...@ovn.org> wrote:
>
> CC: Han Zhou <zhou...@gmail.com>
> Signed-off-by: Ben Pfaff <b...@ovn.org>
> ---
>  include/openvswitch/util.h | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/include/openvswitch/util.h b/include/openvswitch/util.h
> index b4d49ee21804..9189e6480b1c 100644
> --- a/include/openvswitch/util.h
> +++ b/include/openvswitch/util.h
> @@ -273,8 +273,14 @@ is_pow2(uintmax_t x)
>  #define BITMAP_ULONG_BITS (sizeof(unsigned long) * CHAR_BIT)
>  #define BITMAP_N_LONGS(N_BITS) DIV_ROUND_UP(N_BITS, BITMAP_ULONG_BITS)
>
> -/* Given ATTR, and TYPE, cast the ATTR to TYPE by first casting ATTR to
> - * (void *). This is to suppress the alignment warning issued by clang.
*/
> +/* Given ATTR, and TYPE, cast the ATTR to TYPE by first casting ATTR to
(void
> + * *).  This suppresses the alignment warning issued by Clang and newer
> + * versions of GCC when a pointer is cast to a type with a stricter
alignment.
> + *
> + * Add ALIGNED_CAST only if you are sure that the cast is actually
correct,
> + * that is, that the pointer is actually properly aligned for the
stricter
> + * type.  On RISC architectures, dereferencing a misaligned pointer can
cause a
> + * segfault, so it is important to be aware of correct alignment. */
>  #define ALIGNED_CAST(TYPE, ATTR) ((TYPE) (void *) (ATTR))
>
>  #ifdef __cplusplus
> --
> 2.16.1
>

Thanks Ben.
Acked-by: Han Zhou <hzh...@ebay.com>
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to