lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0dcdeebf-46f1-41c1-b5c8-050bca5d8e1f@web.de>
Date: Mon, 25 Dec 2023 18:40:26 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-edac@...r.kernel.org, kernel-janitors@...r.kernel.org,
 Borislav Petkov <bp@...en8.de>, James Morse <james.morse@....com>,
 Mauro Carvalho Chehab <mchehab@...nel.org>, Robert Richter
 <rric@...nel.org>, Tony Luck <tony.luck@...el.com>,
 Yazen Ghannam <yazen.ghannam@....com>
Cc: LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr,
 Muralidhara M K <muralidhara.mk@....com>
Subject: [PATCH 4/7] EDAC/amd64: Adjust error handling in probe_one_instance()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Mon, 25 Dec 2023 17:18:14 +0100

1. Return directly after a call of the function “kzalloc” failed
   at the beginning.

2. Delete the label “err_out” which became unnecessary
   with this refactoring.

3. Move an error code assignment into an if branch.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/edac/amd64_edac.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 49f3d9b54902..64680de47cab 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -4268,16 +4268,17 @@ static int probe_one_instance(unsigned int nid)
 	struct ecc_settings *s;
 	int ret;

-	ret = -ENOMEM;
 	s = kzalloc(sizeof(struct ecc_settings), GFP_KERNEL);
 	if (!s)
-		goto err_out;
+		return -ENOMEM;

 	ecc_stngs[nid] = s;

 	pvt = kzalloc(sizeof(struct amd64_pvt), GFP_KERNEL);
-	if (!pvt)
+	if (!pvt) {
+		ret = -ENOMEM;
 		goto err_settings;
+	}

 	pvt->mc_node_id	= nid;
 	pvt->F3 = F3;
@@ -4336,8 +4337,6 @@ static int probe_one_instance(unsigned int nid)
 err_settings:
 	kfree(s);
 	ecc_stngs[nid] = NULL;
-
-err_out:
 	return ret;
 }

--
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ