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: <54351127-7222-c578-10f7-ee0dbf8f7879@users.sourceforge.net>
Date:   Mon, 14 Aug 2017 13:16:55 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-mm@...ck.org, Dan Streetman <ddstreet@...e.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 2/2] zpool: Use common error handling code in
 zpool_create_pool()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Mon, 14 Aug 2017 13:04:33 +0200

Add a jump target so that a bit of exception handling can be better reused
in this function.

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

diff --git a/mm/zpool.c b/mm/zpool.c
index fe1943f7d844..e4634edef86d 100644
--- a/mm/zpool.c
+++ b/mm/zpool.c
@@ -171,10 +171,8 @@ struct zpool *zpool_create_pool(const char *type, const char *name, gfp_t gfp,
 	}
 
 	zpool = kmalloc(sizeof(*zpool), gfp);
-	if (!zpool) {
-		zpool_put_driver(driver);
-		return NULL;
-	}
+	if (!zpool)
+		goto put_driver;
 
 	zpool->driver = driver;
 	zpool->pool = driver->create(name, gfp, ops, zpool);
@@ -182,8 +180,9 @@ struct zpool *zpool_create_pool(const char *type, const char *name, gfp_t gfp,
 
 	if (!zpool->pool) {
 		pr_err("couldn't create %s pool\n", type);
-		zpool_put_driver(driver);
 		kfree(zpool);
+put_driver:
+		zpool_put_driver(driver);
 		return NULL;
 	}
 
-- 
2.14.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ