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: <564B4BE6.6010209@users.sourceforge.net>
Date:	Tue, 17 Nov 2015 16:46:46 +0100
From:	SF Markus Elfring <elfring@...rs.sourceforge.net>
To:	linux-crypto@...r.kernel.org,
	Herbert Xu <herbert@...dor.apana.org.au>,
	"David S. Miller" <davem@...emloft.net>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org,
	Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH v2 3/3] crypto-ixp4xx: Less function calls in
 init_ixp_crypto() after error detection

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 17 Nov 2015 16:15:21 +0100

The dma_pool_destroy() function was called in up to two cases by the
init_ixp_crypto() function during error handling even if a call of
the dma_pool_create() function failed.

This implementation detail could be improved by the adjustment
of jump targets according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/crypto/ixp4xx_crypto.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index 79b6958..0a5969c 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -483,23 +483,23 @@ static int init_ixp_crypto(struct device *dev)
 			sizeof(struct buffer_desc), 32, 0);
 	if (!buffer_pool) {
 		ret = -ENOMEM;
-		goto err;
+		goto release_npe;
 	}
 	ctx_pool = dma_pool_create("context", dev,
 			NPE_CTX_LEN, 16, 0);
 	if (!ctx_pool) {
 		ret = -ENOMEM;
-		goto err;
+		goto destroy_buffer_pool;
 	}
 	ret = qmgr_request_queue(SEND_QID, NPE_QLEN_TOTAL, 0, 0,
 				 "ixp_crypto:out", NULL);
 	if (ret)
-		goto err;
+		goto destroy_ctx_pool;
 	ret = qmgr_request_queue(RECV_QID, NPE_QLEN, 0, 0,
 				 "ixp_crypto:in", NULL);
 	if (ret) {
 		qmgr_release_queue(SEND_QID);
-		goto err;
+		goto destroy_ctx_pool;
 	}
 	qmgr_set_irq(RECV_QID, QUEUE_IRQ_SRC_NOT_EMPTY, irqhandler, NULL);
 	tasklet_init(&crypto_done_tasklet, crypto_done_action, 0);
@@ -510,9 +510,11 @@ static int init_ixp_crypto(struct device *dev)
 npe_error:
 	printk(KERN_ERR "%s not responding\n", npe_name(npe_c));
 	ret = -EIO;
-err:
+destroy_ctx_pool:
 	dma_pool_destroy(ctx_pool);
+destroy_buffer_pool:
 	dma_pool_destroy(buffer_pool);
+release_npe:
 	npe_release(npe_c);
 	return ret;
 }
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ