Skip to content

Commit

Permalink
drm/amd/display: change kzalloc to kcalloc in dcn314_validate_bandwid…
Browse files Browse the repository at this point in the history
…th()

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>
  • Loading branch information
Ethan Carter Edwards authored and Alex Deucher committed Mar 10, 2025
1 parent 934cb52 commit b17a94f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,8 @@ bool dcn314_validate_bandwidth(struct dc *dc,

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);
DC_LOGGER_INIT(dc->ctx->logger);

BW_VAL_TRACE_COUNT();
Expand Down

0 comments on commit b17a94f

Please sign in to comment.