linux/drivers/gpu/drm/amd/display/dc/basics
Harry Wentland 3766856864 drm/amd/display: Use krealloc_array() in dal_vector_reserve()
[Why & How]
dal_vector_reserve() computes the allocation size as
"capacity * vector->struct_size" using uint32_t arithmetic, which can
silently wrap to a small value on overflow. This would cause krealloc to
return a smaller buffer than expected, leading to heap overflows on
subsequent vector appends.

Replace krealloc() with krealloc_array() which performs an internal
overflow check and returns NULL on wrap, preventing the issue.

Fixes: 2004f45ef8 ("drm/amd/display: Use kernel alloc/free")
Assisted-by: Copilot:claude-opus-4.6
Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Ray Wu <ray.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-06-03 13:35:57 -04:00
..
bw_fixed.c drm/amd/display: Move bw_fixed from DML folder 2023-10-09 16:48:37 -04:00
calcs_logger.h drm/amd/display: Move dce_calcs from DML folder 2023-10-09 16:48:22 -04:00
conversion.c drm/amd/display: Fix type mismatches using guards and explicit casts 2026-05-05 09:56:52 -04:00
conversion.h drm/amd/display: Add dpp_get_gamut_remap functions 2024-01-22 17:13:26 -05:00
custom_float.c drm/amd/display: Fix implicit narrowing conversion warnings 2026-04-17 15:41:15 -04:00
dc_common.c drm/amd/display: Fix BT2020 YCbCr limited/full range input 2025-02-19 15:14:10 -05:00
dc_common.h Revert "drm/amd/display: Unblank hubp based on plane visibility" 2021-02-18 16:43:10 -05:00
dce_calcs.c drm/amd/display: Fix type mismatches using guards and explicit casts 2026-05-05 09:56:52 -04:00
fixpt31_32.c drm/amd/display: Fixed Silence complier warnings in dc 2026-03-30 15:12:15 -04:00
logger.h drm/amd/display: add performance trace macro to dc 2017-10-21 16:50:00 -04:00
Makefile drm/amd/display: Move bw_fixed from DML folder 2023-10-09 16:48:37 -04:00
vector.c drm/amd/display: Use krealloc_array() in dal_vector_reserve() 2026-06-03 13:35:57 -04:00