android_kernel_samsung_sm8650/drivers/cxl/core
Quanquan Cao ec745eeff4 cxl/region:Fix overflow issue in alloc_hpa()
commit d76779dd3681c01a4c6c3cae4d0627c9083e0ee6 upstream.

Creating a region with 16 memory devices caused a problem. The div_u64_rem
function, used for dividing an unsigned 64-bit number by a 32-bit one,
faced an issue when SZ_256M * p->interleave_ways. The result surpassed
the maximum limit of the 32-bit divisor (4G), leading to an overflow
and a remainder of 0.
note: At this point, p->interleave_ways is 16, meaning 16 * 256M = 4G

To fix this issue, I replaced the div_u64_rem function with div64_u64_rem
and adjusted the type of the remainder.

Signed-off-by: Quanquan Cao <caoqq@fujitsu.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Fixes: 23a22cd1c9 ("cxl/region: Allocate HPA capacity to regions")
Cc: <stable@vger.kernel.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-01-31 16:17:12 -08:00
..
core.h tools/testing/cxl: Define a fixed volatile configuration to parse 2023-11-28 17:07:17 +00:00
hdm.c tools/testing/cxl: Define a fixed volatile configuration to parse 2023-11-28 17:07:17 +00:00
Makefile cxl/region: Add region creation support 2022-07-21 17:19:25 -07:00
mbox.c cxl/mbox: Add a check on input payload size 2022-10-20 16:28:53 -07:00
memdev.c cxl/mem: Fix shutdown order 2023-11-20 11:52:13 +01:00
pci.c cxl: Wait Memory_Info_Valid before access memory related info 2023-05-30 14:03:32 +01:00
pmem.c cxl/pmem: Fix cxl_pmem_region and cxl_memdev leak 2022-11-04 15:58:35 -07:00
port.c cxl/port: Fix decoder initialization when nr_targets > interleave_ways 2024-01-25 15:27:44 -08:00
region.c cxl/region:Fix overflow issue in alloc_hpa() 2024-01-31 16:17:12 -08:00
regs.c cxl/regs: Fix size of CXL Capability Header Register 2022-02-08 23:15:33 -08:00
suspend.c PM: CXL: Disable suspend 2022-04-22 16:09:42 -07:00