diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2012-06-06 13:11:05 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-06-11 11:43:16 -0400 |
commit | 8447c4d15e357a458c9051ddc84aa6c8b9c27000 (patch) | |
tree | 33377297a94e02d0a87246010c8f4c83d8119bb2 | |
parent | b9bc5ddb1b76d3f7ee14c533300aa95907c6969e (diff) |
edac: Do alignment logic properly in edac_align_ptr()
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | 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 10f375032e96..de5ba86e8b89 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) | |||
164 | else | 164 | else |
165 | return (char *)ptr; | 165 | return (char *)ptr; |
166 | 166 | ||
167 | r = size % align; | 167 | r = (unsigned long)p % align; |
168 | 168 | ||
169 | if (r == 0) | 169 | if (r == 0) |
170 | return (char *)ptr; | 170 | return (char *)ptr; |