Re: [PATCH] some Alpha cleanups

Guest section DW (dwguest@win.tue.nl)
Sun, 24 Jan 1999 00:42:16 +0100 (MET)


From: alan@lxorguk.ukuu.org.uk (Alan Cox)
Subject: Re: [PATCH] some Alpha cleanups

> In the ide_disk.c: forcing int pointer to the location known
> to be unaligned looks ugly for me (and for alpha too :) and
> causes unaligned trap. I suggest the following patch (or use
> macros from asm/unaligned.h instead)

Can I suggest something different for all these cases. You can tell
egcs something is packed and may not be suitably aligned as an attribute.
Use that instead. Let the compiler do the brainwork.

Hmm. I have not seen the message you react to, but I suppose
it was a complaint about the code

*(int *)&id->cur_capacity0 = id->lba_capacity;

in ide_disk.c. Such code is terrible.
Nobody knows the order of the two shorts in an int.
And everyone who does know will be sorry.
On some machines this will work, on others it won't.

So, not only does this give an unaligned trap.
It is just plainly wrong.

Finally, we do not want to correct this code, but to
remove this code, since it does nothing useful
but destroys information.

Andries

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/