[openib-general] [PATCH] IB/core - ib_umad can cause address alignment fault on ia64

Michael S. Tsirkin mst at mellanox.co.il
Wed Jan 17 20:39:23 PST 2007


> Quoting Ralph Campbell <ralph.campbell at qlogic.com>:
> Subject: [PATCH] IB/core - ib_umad can cause address alignment fault on ia64
> 
> IB/core - ib_umad can cause address alignment fault
> 
> In user_mad.c, the definition for struct ib_umad_packet includes
> struct ib_user_mad at an odd 32-bit offset.  When ib_umad_write()
> tries to assign rmpp_mad->mad_hdr.tid, there is an alignment fault on
> architectures which have strict alignment for load/stores.
> This patch fixes the problem by changing the offset on which
> struct ib_user_mad is defined within struct ib_umad_packet.
> 
> Thanks go to John W. Marland <jwm at prairieinet.net> for finding this.
> 
> Signed-off-by: Ralph Campbell <ralph.campbell at qlogic.com>
> 
> diff -r b1128b48dc99 drivers/infiniband/core/user_mad.c
> --- a/drivers/infiniband/core/user_mad.c	Fri Jan 12 20:00:03 2007 +0000
> +++ b/drivers/infiniband/core/user_mad.c	Wed Jan 17 14:09:37 2007 -0800
> @@ -125,7 +125,7 @@ struct ib_umad_packet {
>  	struct ib_mad_send_buf *msg;
>  	struct ib_mad_recv_wc  *recv_wc;
>  	struct list_head   list;
> -	int		   length;
> +	long		   length;
>  	struct ib_user_mad mad;
>  };

This does not make sense to me - do we have to replace all int fields with long
now? Looks like a compiler or makefile bug in your setup - struct fields should
be naturally aligned.

-- 
MST




More information about the general mailing list