summaryrefslogtreecommitdiffstats
path: root/drivers/staging/ccree/ssi_ivgen.c
diff options
context:
space:
mode:
authorGilad Ben-Yossef2018-01-07 13:14:34 +0100
committerGreg Kroah-Hartman2018-01-08 16:29:36 +0100
commit2392b84fb2f8daf71e70dd13101ec70ff636a3d3 (patch)
tree74e98618cf06d07e0ea217f4aaa2e8768f7c3888 /drivers/staging/ccree/ssi_ivgen.c
parentstaging: ccree: put pointer next to var name (diff)
downloadkernel-qcow2-linux-2392b84fb2f8daf71e70dd13101ec70ff636a3d3.tar.gz
kernel-qcow2-linux-2392b84fb2f8daf71e70dd13101ec70ff636a3d3.tar.xz
kernel-qcow2-linux-2392b84fb2f8daf71e70dd13101ec70ff636a3d3.zip
stating: ccree: fix allocation of void sized buf
We were allocating buffers using sizeof(*struct->field) where field was type void. Fix it by having a local variable with the real type. Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ccree/ssi_ivgen.c')
-rw-r--r--drivers/staging/ccree/ssi_ivgen.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/staging/ccree/ssi_ivgen.c b/drivers/staging/ccree/ssi_ivgen.c
index 6b926495c5d2..2ba15a5c631f 100644
--- a/drivers/staging/ccree/ssi_ivgen.c
+++ b/drivers/staging/ccree/ssi_ivgen.c
@@ -175,13 +175,10 @@ int cc_ivgen_init(struct cc_drvdata *drvdata)
int rc;
/* Allocate "this" context */
- drvdata->ivgen_handle = kzalloc(sizeof(*drvdata->ivgen_handle),
- GFP_KERNEL);
- if (!drvdata->ivgen_handle)
+ ivgen_ctx = kzalloc(sizeof(*ivgen_ctx), GFP_KERNEL);
+ if (!ivgen_ctx)
return -ENOMEM;
- ivgen_ctx = drvdata->ivgen_handle;
-
/* Allocate pool's header for initial enc. key/IV */
ivgen_ctx->pool_meta = dma_alloc_coherent(device, CC_IVPOOL_META_SIZE,
&ivgen_ctx->pool_meta_dma,
@@ -200,6 +197,8 @@ int cc_ivgen_init(struct cc_drvdata *drvdata)
goto out;
}
+ drvdata->ivgen_handle = ivgen_ctx;
+
return cc_init_iv_sram(drvdata);
out: