[PATCH 2/3] EDAC: sb_edac: Handle return value of kasprintf
From: Arvind Yadav
Date: Thu Sep 21 2017 - 03:54:54 EST
kasprintf() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
---
drivers/edac/sb_edac.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index dc05916..2b9e831 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -3286,6 +3286,10 @@ static int sbridge_register_mci(struct sbridge_dev *sbridge_dev, enum type type)
pvt->sbridge_dev->source_id, pvt->sbridge_dev->dom);
break;
}
+ if (!mci->ctl_name) {
+ rc = -ENOMEM;
+ goto fail0;
+ }
/* Get dimm basic config and the memory layout */
rc = get_dimm_config(mci);
--
1.9.1