diff options
author | Quanquan Cao <caoqq@fujitsu.com> | 2024-01-24 17:15:26 +0800 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2024-01-24 21:03:03 -0800 |
commit | d76779dd3681c01a4c6c3cae4d0627c9083e0ee6 (patch) | |
tree | 128c989019e7e6c1d72369f9422570085dd935ea /security/Kconfig | |
parent | d72a4caf685989e353dff0a97d7376ee10edbf87 (diff) |
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: 23a22cd1c98b ("cxl/region: Allocate HPA capacity to regions")
Cc: <stable@vger.kernel.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'security/Kconfig')
0 files changed, 0 insertions, 0 deletions