Skip to content

Commit f77ebdd

Browse files
lumagGeorgi Djakov
authored andcommitted
interconnect: qcom: osm-l3: fix icc_onecell_data allocation
This is a struct with a trailing zero-length array of icc_node pointers but it's allocated as if it were a single array of icc_nodes instead. Fortunately this overallocates memory rather then allocating less memory than required. Fix by replacing devm_kcalloc() with devm_kzalloc() and struct_size() macro. Fixes: 5bc9900 ("interconnect: qcom: Add OSM L3 interconnect provider support") Signed-off-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Georgi Djakov <[email protected]>
1 parent fe15c26 commit f77ebdd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/interconnect/qcom/osm-l3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ static int qcom_osm_l3_probe(struct platform_device *pdev)
236236
qnodes = desc->nodes;
237237
num_nodes = desc->num_nodes;
238238

239-
data = devm_kcalloc(&pdev->dev, num_nodes, sizeof(*node), GFP_KERNEL);
239+
data = devm_kzalloc(&pdev->dev, struct_size(data, nodes, num_nodes), GFP_KERNEL);
240240
if (!data)
241241
return -ENOMEM;
242242

0 commit comments

Comments
 (0)