提交 8447c4d1 编写于 作者: C Chris Metcalf 提交者: Mauro Carvalho Chehab

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: NChris Metcalf <cmetcalf@tilera.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 b9bc5ddb
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册