drm/msm: Fix incorrect struct size for memory allocation
Subsystems (4)
PATCH 1/1 drm/msm: Fix incorrect struct size for memory allocation
The allocation for the clock bulk data does a classic sizeof(pointer) instead of sizeof(struct) so the array ends up incorrectly sized for the clock data.
Fixes 8e54eea ("drm/msm: Add a helper function to parse clock names")
Signed-off-by Jordan Crouse <[email protected]>
---
drivers/gpu/drm/msm/msm_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_drv.c +1 -1
@@ -96,7 +96,7 @@ int msm_clk_bulk_get(struct device *dev, struct clk_bulk_data **bulk)if (count <1 )return 0 ; - local =devm_kcalloc (dev,sizeof (struct clk_bulk_data *), + local =devm_kcalloc (dev,sizeof (struct clk_bulk_data ), count,GFP_KERNEL );if (!local)return -ENOMEM ;
Signature · 1 line
2.7.4
Quoted 18 lines · Jordan Crouse
The allocation for the clock bulk data does a classic sizeof(pointer) instead of sizeof(struct) so the array ends up incorrectly sized for the clock data.
Fixes 8e54eea ("drm/msm: Add a helper function to parse clock names")Signed-off-by Jordan Crouse <[email protected]>---
drivers/gpu/drm/msm/msm_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/msm/msm_drv.c +0
-0
drivers/gpu/drm/msm/msm_drv.c int msm_clk_bulk_get(struct device *dev, struct clk_bulk_data **bulk) · line 102
Quoted 8 lines
drivers/gpu/drm/msm/msm_drv.c +1
-1@@ -96,7 +96,7 @@ int msm_clk_bulk_get(struct device *dev, struct clk_bulk_data **bulk)if (count <1 )return 0 ; - local =devm_kcalloc (dev,sizeof (struct clk_bulk_data *), + local =devm_kcalloc (dev,sizeof (struct clk_bulk_data ), count,GFP_KERNEL );if (!local)return -ENOMEM ;
Isn't msm_clk_bulk_get a duplication of devm_clk_bulk_get_all() ? Surely it would be better to just use that instead?
Signature · 4 lines
Jeffrey Hugo Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.