drm/amd/display: Use kcalloc() instead of kzalloc()
Subsystems (3)
PATCH 1/1 drm/amd/display: Use kcalloc() instead of kzalloc()
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.
Signed-off-by Lenko Donchev <[email protected]>
--- drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c +1 -1
@@ -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 ); } }
Signature · 1 line
2.43.0
Quoted 18 lines · Lenko Donchev
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.Signed-off-by Lenko Donchev <[email protected]>--- drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c +0
-0
drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c static void dpcd_extend_address_range( · line 170
Quoted 8 lines
drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c +1
-1@@ -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 ); } }
lgtm,
Reviewed-by Rodrigo Siqueira <[email protected]>