[linux-yocto] [PATCH 02/15] drivers/edac: Fixed kmemleak cm issue.
Daniel Dragomir
daniel.dragomir at windriver.com
Tue Jun 27 08:41:02 PDT 2017
From: Marek Majtyka <marekx.majtyka at intel.com>
Lack of proper cm memory controller configuration in uboot
parameter file causes single memory leakage of 64B per memory
controller (defined in devicetree).
Signed-off-by: Marek Majtyka <marekx.majtyka at intel.com>
---
drivers/edac/axxia_edac-cmc_56xx.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/edac/axxia_edac-cmc_56xx.c b/drivers/edac/axxia_edac-cmc_56xx.c
index 5bc8b41..690d31f 100644
--- a/drivers/edac/axxia_edac-cmc_56xx.c
+++ b/drivers/edac/axxia_edac-cmc_56xx.c
@@ -951,6 +951,16 @@ static int intel_edac_mc_probe(struct platform_device *pdev)
if (!dev_info)
goto err_nomem;
+ dev_info->ctl_name =
+ devm_kzalloc(&pdev->dev, 32*sizeof(char), GFP_KERNEL);
+ if (!dev_info->ctl_name)
+ goto err_nomem;
+
+ dev_info->blk_name =
+ devm_kzalloc(&pdev->dev, 32*sizeof(char), GFP_KERNEL);
+ if (!dev_info->blk_name)
+ goto err_nomem;
+
dev_info->data =
devm_kzalloc(&pdev->dev, sizeof(*dev_info->data), GFP_KERNEL);
if (!dev_info->data)
@@ -962,8 +972,12 @@ static int intel_edac_mc_probe(struct platform_device *pdev)
raw_spin_lock_init(&dev_info->data->mpr_data_lock);
mutex_init(&dev_info->data->edac_sysfs_data_lock);
- dev_info->ctl_name = kstrdup(np->name, GFP_KERNEL);
- dev_info->blk_name = "ECC";
+ strncpy(dev_info->ctl_name, np->name, 32);
+ dev_info->ctl_name[31] = '\0';
+
+ strncpy(dev_info->blk_name, "ECC", 32);
+ dev_info->ctl_name[31] = '\0';
+
edac_op_state = EDAC_OPSTATE_POLL;
dev_info->pdev = pdev;
--
2.7.4
More information about the linux-yocto
mailing list