soc: qcom: dcc: Avoid huge memory allcation
Check size of DCC configuration. Limit the size according
to SRAM size.
CRs-Fixed: 2224975
Change-Id: I40f4211468c93ece42b85e1f2d326b16965bce22
Signed-off-by: Shaoqing Liu <shaoqingliu@codeaurora.org>
diff --git a/drivers/soc/qcom/dcc.c b/drivers/soc/qcom/dcc.c
index a687286..bef0757 100644
--- a/drivers/soc/qcom/dcc.c
+++ b/drivers/soc/qcom/dcc.c
@@ -731,7 +731,8 @@
mutex_lock(&drvdata->mutex);
- if (!len) {
+ /* Check the len to avoid allocate huge memory */
+ if (!len || len > (drvdata->ram_size / 8)) {
dev_err(drvdata->dev, "DCC: Invalid length!\n");
ret = -EINVAL;
goto err;