Skip to contentSkip to conversation

drm/amd/display/dc/calcs/dce_calcs: Fix allocation size for dceip and vbios

PATCH In review Colin King 2 participants 2 messages Mar 23, 2021

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 drm/amd/display/dc/calcs/dce_calcs: Fix allocation size for dceip and vbios

From: Colin Ian King <[email protected]>

Currently the allocations for dceip and vbios are based on the size of the pointer rather than the size of the data structures, causing heap issues. Fix this by using the correct allocation sizes.

Addresses-Coverity: ("Wrong size of argument")

Fixes a2a855772210 ("drm/amd/display/dc/calcs/dce_calcs: Remove some large variables from the stack")
---
 drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +2 -2
index 556ecfabc8d2..1244fcb0f446 100644
@@ -2051,11 +2051,11 @@ void bw_calcs_init(struct bw_calcs_dceip *bw_dceip,
 
 	enum bw_calcs_version version = bw_calcs_version_from_asic_id(asic_id);
 
-	dceip = kzalloc(sizeof(dceip), GFP_KERNEL);
+	dceip = kzalloc(sizeof(*dceip), GFP_KERNEL);
 	if (!dceip)
 		return;
 
-	vbios = kzalloc(sizeof(vbios), GFP_KERNEL);
+	vbios = kzalloc(sizeof(*vbios), GFP_KERNEL);
 	if (!vbios) {
 		kfree(dceip);
 		return;
Signature · 6 lines
2.30.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 6 lines · Colin King

From: Colin Ian King <[email protected]>

Currently the allocations for dceip and vbios are based on the size of the pointer rather than the size of the data structures, causing heap issues. Fix this by using the correct allocation sizes.

Quoted 6 lines

Addresses-Coverity: ("Wrong size of argument")

Fixes a2a855772210 ("drm/amd/display/dc/calcs/dce_calcs: Remove some large variables from the stack")
---
 drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Fixed already mate.

Signature · 8 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel