[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1505980393-20307-2-git-send-email-arvind.yadav.cs@gmail.com>
Date: Thu, 21 Sep 2017 13:23:11 +0530
From: Arvind Yadav <arvind.yadav.cs@...il.com>
To: mchehab@...nel.org, bp@...en8.de, tony.luck@...el.com
Cc: linux-edac@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/3] EDAC: i7core: Handle return value of kasprintf
kasprintf() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.com>
---
drivers/edac/i7core_edac.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index c16c3b9..054f361 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -2161,6 +2161,11 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev)
mci->mod_name = "i7core_edac.c";
mci->ctl_name = kasprintf(GFP_KERNEL, "i7 core #%d",
i7core_dev->socket);
+ if (!mci->ctl_name) {
+ rc = -ENOMEM;
+ goto fail1;
+ }
+
mci->dev_name = pci_name(i7core_dev->pdev[0]);
mci->ctl_page_to_phys = NULL;
@@ -2214,6 +2219,7 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev)
fail0:
kfree(mci->ctl_name);
+fail1:
edac_mc_free(mci);
i7core_dev->mci = NULL;
return rc;
--
1.9.1
Powered by blists - more mailing lists