netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "alpha @ steudten Engineering" <alpha@steudten.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Ingo Oeser <netdev@axxeo.de>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Richard Henderson <rth@twiddle.net>,
	shemminger@osdl.org, p_gortmaker@yahoo.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	ioe-lkml@rameria.de
Subject: Re: Fw: [Bug 6421] New: kernel 2.6.10-2.6.16 on alpha: arch/alpha/kernel/io.c, iowrite16_rep() BUG_ON((unsigned long)src & 0x1) triggered
Date: Sat, 22 Apr 2006 09:56:07 +0200	[thread overview]
Message-ID: <4449E197.1020102@steudten.org> (raw)
In-Reply-To: <20060421161227.00d688d6.akpm@osdl.org>

Running this on my alpha gives (gcc 4.0.2):

3000
0123456A01234567


Andrew Morton wrote:

>> Because networking does read/write "short" fields in various packet
>> header structures. Results are illustrated in a following example:
>>
>> char foo[] __attribute__((aligned(8))) = "0123456701234567";
>>
>> int main()
>> {
>> 	short *bar = (short *)&foo[7];
>> 	printf("%04x\n", *bar); /* 3037 */
>> 	*bar = 0x4241; /* "AB" */
>> 	printf("%s\n", foo);
>> 	return 0;
>> }
>> --------
>> 0037
>> ^^
>> 0123456A01234567
>>         ^
>> Misalignment by two bytes for ints and longs is often unavoidable in
>> networking and we can cope with it, but there is no excuse of 1-byte
>> misalignment.



  reply	other threads:[~2006-04-22 18:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-21 17:27 Fw: [Bug 6421] New: kernel 2.6.10-2.6.16 on alpha: arch/alpha/kernel/io.c, iowrite16_rep() BUG_ON((unsigned long)src & 0x1) triggered Stephen Hemminger
2006-04-21 17:45 ` Ingo Oeser
2006-04-21 23:12   ` Andrew Morton
2006-04-22  7:56     ` alpha @ steudten Engineering [this message]
2006-04-23  5:43 ` Herbert Xu
2006-04-23  5:49   ` Herbert Xu

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=4449E197.1020102@steudten.org \
    --to=alpha@steudten.com \
    --cc=akpm@osdl.org \
    --cc=ink@jurassic.park.msu.ru \
    --cc=ioe-lkml@rameria.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@axxeo.de \
    --cc=netdev@vger.kernel.org \
    --cc=p_gortmaker@yahoo.com \
    --cc=rth@twiddle.net \
    --cc=shemminger@osdl.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).