Skip to content

Commit 315ce6c

Browse files
ethancedwards8alexdeucher
authored andcommitted
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 <siqueira@igalia.com> Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent b17a94f commit 315ce6c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,8 @@ static bool dml1_validate(struct dc *dc, struct dc_state *context, bool fast_val
17491749

17501750
int vlevel = 0;
17511751
int pipe_cnt = 0;
1752-
display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_KERNEL);
1752+
display_e2e_pipe_params_st *pipes = kcalloc(dc->res_pool->pipe_count,
1753+
sizeof(display_e2e_pipe_params_st), GFP_KERNEL);
17531754

17541755
/* To handle Freesync properly, setting FreeSync DML parameters
17551756
* to its default state for the first stage of validation

0 commit comments

Comments
 (0)