Skip to content

Commit 934cb52

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

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c

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

17691769
int vlevel = 0;
17701770
int pipe_cnt = 0;
1771-
display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_KERNEL);
1771+
display_e2e_pipe_params_st *pipes = kcalloc(dc->res_pool->pipe_count,
1772+
sizeof(display_e2e_pipe_params_st), GFP_KERNEL);
17721773
DC_LOGGER_INIT(dc->ctx->logger);
17731774

17741775
BW_VAL_TRACE_COUNT();

0 commit comments

Comments
 (0)