Patch "interconnect: qcom: osm-l3: fix icc_onecell_data allocation" has been added to the 6.2-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    interconnect: qcom: osm-l3: fix icc_onecell_data allocation

to the 6.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     interconnect-qcom-osm-l3-fix-icc_onecell_data-alloca.patch
and it can be found in the queue-6.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e21bb5f068b0eea450dea2166379218b29eec260
Author: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
Date:   Thu Jan 5 02:22:19 2023 +0200

    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@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230105002221.1416479-2-dmitry.baryshkov@xxxxxxxxxx
    Signed-off-by: Georgi Djakov <djakov@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/interconnect/qcom/osm-l3.c b/drivers/interconnect/qcom/osm-l3.c
index 3a1cbfe3e481f..1bafb54f14329 100644
--- a/drivers/interconnect/qcom/osm-l3.c
+++ b/drivers/interconnect/qcom/osm-l3.c
@@ -236,7 +236,7 @@ static int qcom_osm_l3_probe(struct platform_device *pdev)
 	qnodes = desc->nodes;
 	num_nodes = desc->num_nodes;
 
-	data = devm_kcalloc(&pdev->dev, num_nodes, sizeof(*node), GFP_KERNEL);
+	data = devm_kzalloc(&pdev->dev, struct_size(data, nodes, num_nodes), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux