public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] edac: Do alignment logic properly in edac_align_ptr()
@ 2012-06-06 17:11 Chris Metcalf
  2012-06-11 15:35 ` Chris Metcalf
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Metcalf @ 2012-06-06 17:11 UTC (permalink / raw)
  To: Doug Thompson, Mauro Carvalho Chehab, linux-edac, linux-kernel

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!

 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;
-- 
1.6.5.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-11 15:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-06 17:11 [PATCH] edac: Do alignment logic properly in edac_align_ptr() Chris Metcalf
2012-06-11 15:35 ` Chris Metcalf
2012-06-11 15:41   ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox