]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/amd/display: Use kcalloc() instead of kzalloc()
authorLenko Donchev <lenko.donchev@gmail.com>
Sun, 28 Jan 2024 09:04:38 +0000 (03:04 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 22 Feb 2024 15:28:32 +0000 (10:28 -0500)
We are trying to get rid of all multiplications from allocation
functions to prevent integer overflows. Here the multiplication is
obviously safe, but using kcalloc() is more appropriate and improves
readability. This patch has no effect on runtime behavior.

Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
Link: https://github.com/KSPP/linux/issues/162
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Lenko Donchev <lenko.donchev@gmail.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c

index fc50931c2aecbb53d74a2d48913e608134510940..c5de6ed5bf581f1fb2972f195e4663a53345c903 100644 (file)
@@ -164,7 +164,7 @@ static void dpcd_extend_address_range(
        if (new_addr_range.start != in_address || new_addr_range.end != end_address) {
                *out_address = new_addr_range.start;
                *out_size = ADDRESS_RANGE_SIZE(new_addr_range.start, new_addr_range.end);
-               *out_data = kzalloc(*out_size * sizeof(**out_data), GFP_KERNEL);
+               *out_data = kcalloc(*out_size, sizeof(**out_data), GFP_KERNEL);
        }
 }