linux-stable/drivers/cxl/core
Quanquan Cao d76779dd36 cxl/region:Fix overflow issue in alloc_hpa()
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>
2024-01-24 21:03:03 -08:00
..
cdat.c Merge branch 'for-6.7/cxl' into for-6.8/cxl 2024-01-05 19:24:33 -08:00
core.h cxl: Calculate and store PCI link latency for the downstream ports 2023-12-22 14:53:49 -08:00
hdm.c cxl/hdm: Fix dpa translation locking 2023-12-07 19:14:04 -08:00
Makefile cxl: Add callback to parse the DSMAS subtables from CDAT 2023-12-22 14:33:10 -08:00
mbox.c Merge branch 'for-6.8/cxl-cper' into for-6.8/cxl 2024-01-09 19:21:44 -08:00
memdev.c cxl/core: use sysfs_emit() for attr's _show() 2024-01-12 14:47:04 -08:00
pci.c cxl: Calculate and store PCI link latency for the downstream ports 2023-12-22 14:53:49 -08:00
pmem.c cxl: Refactor to use __free() for cxl_root allocation in cxl_find_nvdimm_bridge() 2024-01-05 14:36:29 -08:00
pmu.c cxl/pmu: Ensure put_device on pmu devices 2023-12-14 21:54:45 -08:00
port.c Merge branch 'for-6.7/cxl' into for-6.8/cxl 2024-01-05 19:24:33 -08:00
region.c cxl/region:Fix overflow issue in alloc_hpa() 2024-01-24 21:03:03 -08:00
regs.c cxl/core/regs: Rework cxl_map_pmu_regs() to use map->dev for devm 2023-10-27 20:13:39 -07:00
suspend.c PM: CXL: Disable suspend 2022-04-22 16:09:42 -07:00
trace.c cxl/trace: Add an HPA to cxl_poison trace events 2023-04-23 11:46:13 -07:00
trace.h cxl/events: Create a CXL event union 2024-01-09 15:41:22 -08:00