[linux-yocto] [PATCH 06/15] drivers/edac: Fixed kmemleak sm issue.
Daniel Dragomir
daniel.dragomir at windriver.com
Tue Jun 27 08:41:06 PDT 2017
From: Marek Majtyka <marekx.majtyka at intel.com>
Removed memory leaks found in faulty scenario call flow (similar as
in CMC edac isr).
Signed-off-by: Marek Majtyka <marekx.majtyka at intel.com>
---
drivers/edac/axxia_edac-mc_56xx.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/edac/axxia_edac-mc_56xx.c b/drivers/edac/axxia_edac-mc_56xx.c
index 0866a8c..ad61cbf 100644
--- a/drivers/edac/axxia_edac-mc_56xx.c
+++ b/drivers/edac/axxia_edac-mc_56xx.c
@@ -1192,6 +1192,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)
@@ -1203,6 +1213,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);
+ 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';
+
dev_info->ctl_name = kstrdup(np->name, GFP_KERNEL);
dev_info->blk_name = "ECC";
edac_op_state = EDAC_OPSTATE_POLL;
--
2.7.4
More information about the linux-yocto
mailing list