[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220113100622.12783-2-farbere@amazon.com>
Date: Thu, 13 Jan 2022 10:06:19 +0000
From: Eliav Farber <farbere@...zon.com>
To: <bp@...en8.de>
CC: <mchehab@...nel.org>, <linux-edac@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <ronenk@...zon.com>,
<talel@...zon.com>, <hhhawa@...zon.com>, <jonnyc@...zon.com>,
<hanochu@...zon.com>, <farbere@...zon.com>
Subject: [PATCH 1/4] EDAC: Fix calculation of returned address and next offset in edac_align_ptr()
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@...zon.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
Powered by blists - more mailing lists