public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Metcalf <cmetcalf@tilera.com>
To: Doug Thompson <dougthompson@xmission.com>,
	Mauro Carvalho Chehab <mchehab@redhat.com>,
	<linux-edac@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] edac: Do alignment logic properly in edac_align_ptr()
Date: Mon, 11 Jun 2012 11:35:23 -0400	[thread overview]
Message-ID: <4FD6103B.6020901@tilera.com> (raw)
In-Reply-To: <201206061723.q56HNgtR016254@farm-0002.internal.tilera.com>

On 6/6/2012 1:24 PM, Chris Metcalf wrote:
> The logic was checking the sizeof the structure being allocated to
> determine whether an alignment fixup was required.  This isn't right;
> what we actually care about is the alignment of the actual pointer that's
> about to be returned.  This became an issue recently because struct
> edac_mc_layer has a size that is not zero modulo eight, so we were
> taking the correctly-aligned pointer and forcing it to be misaligned.
> On Tile this caused an alignment exception.
>
> Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
> ---
> Mauro, I assume you will push this through your tree?  I am also happy
> to push it through the tile tree.  Let me know!

Ping - I see this didn't make it into 3.5-rc2.  I'm happy to push the change
through the tile tree if that's helpful (and someone wants to give their
Acked-by).

>
>  drivers/edac/edac_mc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
> index 10f3750..de5ba86 100644
> --- a/drivers/edac/edac_mc.c
> +++ b/drivers/edac/edac_mc.c
> @@ -164,7 +164,7 @@ void *edac_align_ptr(void **p, unsigned size, int n_elems)
>  	else
>  		return (char *)ptr;
>  
> -	r = size % align;
> +	r = (unsigned long)p % align;
>  
>  	if (r == 0)
>  		return (char *)ptr;

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com




  reply	other threads:[~2012-06-11 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-06 17:11 [PATCH] edac: Do alignment logic properly in edac_align_ptr() Chris Metcalf
2012-06-11 15:35 ` Chris Metcalf [this message]
2012-06-11 15:41   ` Mauro Carvalho Chehab

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=4FD6103B.6020901@tilera.com \
    --to=cmetcalf@tilera.com \
    --cc=dougthompson@xmission.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox