Messages in this thread Patch in this message | | | From | Eliav Farber <> | Subject | [PATCH 1/4] EDAC: Fix calculation of returned address and next offset in edac_align_ptr() | Date | Thu, 13 Jan 2022 10:06:19 +0000 |
| |
Do alignment logic properly and use 'ptr' for calculating the remainder of the alignment.
This became an issue because 'struct edac_mc_layer' has a size that is not zero modulo eight, and the next offset that was prepared for the private-data was unaligned, causing an alignment exception.
Signed-off-by: Eliav Farber <farbere@amazon.com> --- drivers/edac/edac_mc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index fd440b35d76e..61d72bd96754 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -265,7 +265,7 @@ void *edac_align_ptr(void **p, unsigned size, int n_elems) else return (char *)ptr; - r = (unsigned long)p % align; + r = (unsigned long)ptr % align; if (r == 0) return (char *)ptr; -- 2.32.0
| |