Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1736433

[PATCH 1/3] EDAC: i7core: Handle return value of kasprintf

From Arvind Yadav <arvind.yadav.cs@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 1/3] EDAC: i7core: Handle return value of kasprintf
Date 2017-09-21 10:00 +0200
Message-ID <us4yS-6pb-9@gated-at.bofh.it> (permalink)
References <us4yR-6pb-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


kasprintf() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] EDAC: Handle return value of kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-21 10:00 +0200
  [PATCH 3/3] EDAC: skx_edac: Handle return value of kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-21 10:00 +0200
  [PATCH 1/3] EDAC: i7core: Handle return value of kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-21 10:00 +0200
  [PATCH 2/3] EDAC: sb_edac: Handle return value of kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-21 10:00 +0200
  Re: [PATCH 0/3] EDAC: Handle return value of kasprintf Borislav Petkov <bp@alien8.de> - 2017-09-21 12:30 +0200

csiph-web