Re: [PATCH BlueZ 06/12] tools: Fix unaligned memory access on smp-tester

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Lizardo,

On Fri, Jan 03, 2014, Anderson Lizardo wrote:
> Fixes clang errors like:
> 
> tools/smp-tester.c:263:11: error: cast from 'uint8_t *' (aka 'unsigned
> char *') to 'u128 *' increases required alignment from 1 to 8
> [-Werror,-Wcast-align]
> ---
>  tools/smp-tester.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/smp-tester.c b/tools/smp-tester.c
> index 685d379..20429a9 100644
> --- a/tools/smp-tester.c
> +++ b/tools/smp-tester.c
> @@ -233,10 +233,16 @@ typedef struct {
>  	uint64_t a, b;
>  } u128;
>  
> -static inline void u128_xor(u128 *r, const u128 *p, const u128 *q)
> +static inline void u128_xor(void *r, const void *p, const void *q)
>  {
> -	r->a = p->a ^ q->a;
> -	r->b = p->b ^ q->b;
> +	const u128 pp = bt_get_unaligned((const u128 *) p);
> +	const u128 qq = bt_get_unaligned((const u128 *) q);
> +	u128 rr;
> +
> +	rr.a = pp.a ^ qq.a;
> +	rr.b = pp.b ^ qq.b;
> +
> +	bt_put_unaligned(rr, (u128 *) r);
>  }

This code was essentially a direct copy of what the kernel side SMP
implementation does. Does this mean we have a problem on the kernel side
too? Could you send a patch for that (after confirming that we do have a
problem there too).

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux