[releng_6 tinderbox] failure on sparc64/sparc64

Peter Jeremy peterjeremy at optushome.com.au
Mon Feb 13 01:38:54 PST 2006


On Mon, 2006-Feb-13 10:48:02 +0200, Giorgos Keramidas wrote:
>Good thinking.  It's probably a good idea to avoid copying random
>garbage, and using something like:
>
>    struct foo foo;
>    uint32_t value[sizeof(uint32_t) * (sizeof(foo) / sizeof(uint32_t) + 1)];

That makes it about 4 times too large - you don't need to multiply by
sizeof(uint32_t).

>and then copying only sizeof(foo) bytes.

And zeroing any remaining bytes to prevent uninitialised data leaking out
of the kernel.

>and won't allow overflowing of value[], but I don't really want to know
>what it does on machines of varying endianess :-)

No worse than trying to write (uint32_t *)&foo;

BTW, the compiler is free to insert padding bytes into struct foo so
it would need to be explicitly zeroed and then the required fields
individually copied in.

-- 
Peter Jeremy


More information about the freebsd-arch mailing list