]> git.baikalelectronics.ru Git - kernel.git/commit
EDAC: Fix calculation of returned address and next offset in edac_align_ptr()
authorEliav Farber <farbere@amazon.com>
Thu, 13 Jan 2022 10:06:19 +0000 (10:06 +0000)
committerBorislav Petkov <bp@suse.de>
Tue, 15 Feb 2022 14:54:46 +0000 (15:54 +0100)
commite291fff4e6fcaad7303768108e080768943b280c
treea41f635355992dc58e78fb429a2526c5599e567c
parent9ef9d9575bfa54b166706bccee87f6694a1f3e7b
EDAC: Fix calculation of returned address and next offset in edac_align_ptr()

Do alignment logic properly and use the "ptr" local variable 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.

The patch in Fixes: which broke this actually wanted to "what we
actually care about is the alignment of the actual pointer that's about
to be returned." But it didn't check that alignment.

Use the correct variable "ptr" for that.

  [ bp: Massage commit message. ]

Fixes: 9cb1025b8a7f ("edac: Do alignment logic properly in edac_align_ptr()")
Signed-off-by: Eliav Farber <farbere@amazon.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220113100622.12783-2-farbere@amazon.com
drivers/edac/edac_mc.c