netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: cmetcalf@tilera.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kaber@trash.net
Subject: Re: [PATCH] ip_options_compile: properly handle unaligned pointer
Date: Tue, 31 May 2011 15:13:21 -0700 (PDT)	[thread overview]
Message-ID: <20110531.151321.494228226.davem@davemloft.net> (raw)
In-Reply-To: <201105292112.p4TLC6cN017178@farm-0002.internal.tilera.com>

From: Chris Metcalf <cmetcalf@tilera.com>
Date: Sun, 29 May 2011 16:55:44 -0400

> The current code takes an unaligned pointer and does htonl() on it to
> make it big-endian, then does a memcpy().  The problem is that the
> compiler decides that since the pointer is to a __be32, it is legal
> to optimize the copy into a processor word store.  However, on an
> architecture that does not handled unaligned writes in kernel space,
> this produces an unaligned exception fault.
> 
> The solution is to track the pointer as a "char *" (which removes a bunch
> of unpleasant casts in any case), and then just use put_unaligned_be32()
> to write the value to memory.
> 
> Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>

Applied, thanks Chris.

      reply	other threads:[~2011-05-31 22:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-29 20:55 [PATCH] ip_options_compile: properly handle unaligned pointer Chris Metcalf
2011-05-31 22:13 ` David Miller [this message]

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=20110531.151321.494228226.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=cmetcalf@tilera.com \
    --cc=kaber@trash.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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).