Source-Changes-D archive

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

Re: CVS commit: src/sys/arch/atari/stand/installboot



christos@ wrote:

> Module Name:	src
> Committed By:	christos
> Date:		Thu Nov 13 17:19:29 UTC 2014
> 
> Modified Files:
> 	src/sys/arch/atari/stand/installboot: installboot.c
> 
> Log Message:
> fix strict aliasing violations

> -	*((u_int16_t *)bb->bb_xxboot + 255) = 0;
> -	*((u_int16_t *)bb->bb_xxboot + 255) = 0x1234 - abcksum(bb->bb_xxboot);
> +	sum = 0;
> +	memcpy(bb->bb_xxboot + 255, &sum, sizeof(sum));
> +	sum = 0x1234 - abcksum(bb->bb_xxboot);
> +	memcpy(bb->bb_xxboot + 255, &sum, sizeof(sum));

I doubt your "bb->bb_xxboot + 255" is the same place
as the original "(u_int16_t *)bb->bb_xxboot + 255"
(the cksum word looks at the end of 512 byte sector).

memcpy(9) looks also awful for readers because it hides endianness..

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index