Re: iso9660 endianness cleanup patch

From: H. Peter Anvin (hpa@transmeta.com)
Date: Tue May 01 2001 - 13:16:31 EST


Andrzej Krzysztofowicz wrote:
>
> Are you sure that the arguments of the following casting
>
> > + return le16_to_cpu(*(u16 *)p);
>
> > + return be16_to_cpu(*(u16 *)p);
>
> > + return le32_to_cpu(*(u32 *)p);
>
> > + return be32_to_cpu(*(u32 *)p);
>
> are properly aligned ?
> I did not revise the code to check it, but AFAIK improperly aligned
> char* pointers cause problem with casting to pointers to 16/32-bit data
> on some architectures (I heard of sucj a problem with alpha).
>
> Maybe there was a reason that the original code did operate on bytes here...
>

Oh bother, you're right of course. We need some kind of standardized
macro for indirecting through a potentially unaligned pointer. It can
just do the dereference (e.g. x86), use left/right accesses (e.g. MIPS),
or do it by byte (others).

Ports people, what do you think?

        -hpa

-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon May 07 2001 - 21:00:10 EST