All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@transmeta.com>
To: Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	kernel list <linux-kernel@vger.kernel.org>,
	torvalds@transmeta.com, Andries.Brouwer@cwi.nl
Subject: Re: iso9660 endianness cleanup patch
Date: Tue, 01 May 2001 11:16:31 -0700	[thread overview]
Message-ID: <3AEEFD7F.3E7C6B3@transmeta.com> (raw)
In-Reply-To: <200105011440.QAA12760@green.mif.pg.gda.pl>

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

  reply	other threads:[~2001-05-01 18:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-01 14:40 iso9660 endianness cleanup patch Andrzej Krzysztofowicz
2001-05-01 18:16 ` H. Peter Anvin [this message]
2001-05-01 18:43   ` H. Peter Anvin
2001-05-01 18:48   ` FIXED " H. Peter Anvin
2001-05-01 20:44   ` Alan Cox
2001-05-01 20:59   ` Linus Torvalds
2001-05-01 21:06     ` H. Peter Anvin
  -- strict thread matches above, loose matches on Subject: below --
2001-05-01  5:30 H. Peter Anvin
2001-05-01  6:14 ` Linus Torvalds
2001-05-01  6:18   ` H. Peter Anvin
2001-05-01 20:21     ` Pavel Machek
2001-05-04  1:51       ` Albert D. Cahalan
2001-05-04  4:59         ` Mike Galbraith
2001-05-01  6:37   ` Albert D. Cahalan
2001-05-01  9:52 ` Tim Riker
2001-05-02  8:52 ` Martin Dalecki
2001-05-02 16:03   ` H. Peter Anvin
2001-05-03 21:59   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3AEEFD7F.3E7C6B3@transmeta.com \
    --to=hpa@transmeta.com \
    --cc=Andries.Brouwer@cwi.nl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=ankry@green.mif.pg.gda.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.