interconnect: qcom: osm-l3: fix icc_onecell_data allocation
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Thu, 5 Jan 2023 00:22:19 +0000 (02:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Mar 2023 10:47:41 +0000 (12:47 +0200)
commitd2430d45f1a07ed54d9a4a829bf17a719f3b5aec
treeecb3335f21a753fee45cbb87c55a74062ffcff07
parent115472395b0a9ea522ba0e106d6dfd7a73df8ba6
interconnect: qcom: osm-l3: fix icc_onecell_data allocation

[ Upstream commit f77ebdda0ee652124061c2ac42399bb6c367e729 ]

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: 5bc9900addaf ("interconnect: qcom: Add OSM L3 interconnect provider support")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20230105002221.1416479-2-dmitry.baryshkov@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/interconnect/qcom/osm-l3.c