Skip to content

Commit b17a94f

Browse files
ethancedwards8alexdeucher
authored andcommitted
drm/amd/display: change kzalloc to kcalloc in dcn314_validate_bandwidth()
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 934cb52 commit b17a94f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1704,7 +1704,8 @@ bool dcn314_validate_bandwidth(struct dc *dc,
17041704

17051705
int vlevel = 0;
17061706
int pipe_cnt = 0;
1707-
display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_KERNEL);
1707+
display_e2e_pipe_params_st *pipes = kcalloc(dc->res_pool->pipe_count,
1708+
sizeof(display_e2e_pipe_params_st), GFP_KERNEL);
17081709
DC_LOGGER_INIT(dc->ctx->logger);
17091710

17101711
BW_VAL_TRACE_COUNT();

0 commit comments

Comments
 (0)