From: Ethan Carter Edwards Date: Thu, 27 Feb 2025 23:16:24 +0000 (-0500) Subject: drm/amd/display: change kzalloc to kcalloc in dml1_validate() X-Git-Tag: v6.15-rc1~120^2~2^2~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=315ce6c41aa9b913461a3e018ce7516435245787;p=thirdparty%2Fkernel%2Flinux.git drm/amd/display: change kzalloc to kcalloc in dml1_validate() We are trying to get rid of all multiplications from allocation functions to prevent integer overflows. Here the multiplication is probably safe, but using kcalloc() is more appropriate and improves readability. This patch has no effect on runtime behavior. Reviewed-by: Rodrigo Siqueira Reviewed-by: Alex Hung Signed-off-by: Ethan Carter Edwards Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c index 6643028760190..2a59cc61ed8c9 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c @@ -1749,7 +1749,8 @@ static bool dml1_validate(struct dc *dc, struct dc_state *context, bool fast_val int vlevel = 0; int pipe_cnt = 0; - display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_KERNEL); + display_e2e_pipe_params_st *pipes = kcalloc(dc->res_pool->pipe_count, + sizeof(display_e2e_pipe_params_st), GFP_KERNEL); /* To handle Freesync properly, setting FreeSync DML parameters * to its default state for the first stage of validation