[PATCH 1/6] Revert "UBUNTU: SAUCE: crypto: thunderx_zip: Fix fallout from CONFIG_VMAP_STACK"

Manoj Iyer manoj.iyer at canonical.com
Fri Aug 17 14:42:01 UTC 2018


This reverts commit 37321174b776c96346b72a8498533d9df0e85a68.

BugLink: https://launchpad.net/bugs/1787469

Signed-off-by: Manoj Iyer <manoj.iyer at canonical.com>
---
 drivers/crypto/cavium/zip/zip_crypto.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/crypto/cavium/zip/zip_crypto.c b/drivers/crypto/cavium/zip/zip_crypto.c
index 2fc9b03e1b40..8df4d26cf9d4 100644
--- a/drivers/crypto/cavium/zip/zip_crypto.c
+++ b/drivers/crypto/cavium/zip/zip_crypto.c
@@ -124,7 +124,7 @@ int zip_compress(const u8 *src, unsigned int slen,
 		 struct zip_kernel_ctx *zip_ctx)
 {
 	struct zip_operation  *zip_ops   = NULL;
-	struct zip_state      *zip_state;
+	struct zip_state      zip_state;
 	struct zip_device     *zip = NULL;
 	int ret;
 
@@ -135,23 +135,20 @@ int zip_compress(const u8 *src, unsigned int slen,
 	if (!zip)
 		return -ENODEV;
 
-	zip_state = kzalloc(sizeof(*zip_state), GFP_KERNEL);
-	if (!zip_state)
-		return -ENOMEM;
-
+	memset(&zip_state, 0, sizeof(struct zip_state));
 	zip_ops = &zip_ctx->zip_comp;
 
 	zip_ops->input_len  = slen;
 	zip_ops->output_len = *dlen;
 	memcpy(zip_ops->input, src, slen);
 
-	ret = zip_deflate(zip_ops, zip_state, zip);
+	ret = zip_deflate(zip_ops, &zip_state, zip);
 
 	if (!ret) {
 		*dlen = zip_ops->output_len;
 		memcpy(dst, zip_ops->output, *dlen);
 	}
-	kfree(zip_state);
+
 	return ret;
 }
 
@@ -160,7 +157,7 @@ int zip_decompress(const u8 *src, unsigned int slen,
 		   struct zip_kernel_ctx *zip_ctx)
 {
 	struct zip_operation  *zip_ops   = NULL;
-	struct zip_state      *zip_state;
+	struct zip_state      zip_state;
 	struct zip_device     *zip = NULL;
 	int ret;
 
@@ -171,10 +168,7 @@ int zip_decompress(const u8 *src, unsigned int slen,
 	if (!zip)
 		return -ENODEV;
 
-	zip_state = kzalloc(sizeof(*zip_state), GFP_KERNEL);
-	if (!zip_state)
-		return -ENOMEM;
-
+	memset(&zip_state, 0, sizeof(struct zip_state));
 	zip_ops = &zip_ctx->zip_decomp;
 	memcpy(zip_ops->input, src, slen);
 
@@ -185,13 +179,13 @@ int zip_decompress(const u8 *src, unsigned int slen,
 	zip_ops->input_len  = slen;
 	zip_ops->output_len = *dlen;
 
-	ret = zip_inflate(zip_ops, zip_state, zip);
+	ret = zip_inflate(zip_ops, &zip_state, zip);
 
 	if (!ret) {
 		*dlen = zip_ops->output_len;
 		memcpy(dst, zip_ops->output, *dlen);
 	}
-	kfree(zip_state);
+
 	return ret;
 }
 
-- 
2.17.1





More information about the kernel-team mailing list