提交 2392b84f 编写于 作者: G Gilad Ben-Yossef 提交者: Greg Kroah-Hartman

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: NGilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 abb8492b
...@@ -175,13 +175,10 @@ int cc_ivgen_init(struct cc_drvdata *drvdata) ...@@ -175,13 +175,10 @@ int cc_ivgen_init(struct cc_drvdata *drvdata)
int rc; int rc;
/* Allocate "this" context */ /* Allocate "this" context */
drvdata->ivgen_handle = kzalloc(sizeof(*drvdata->ivgen_handle), ivgen_ctx = kzalloc(sizeof(*ivgen_ctx), GFP_KERNEL);
GFP_KERNEL); if (!ivgen_ctx)
if (!drvdata->ivgen_handle)
return -ENOMEM; return -ENOMEM;
ivgen_ctx = drvdata->ivgen_handle;
/* Allocate pool's header for initial enc. key/IV */ /* 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_alloc_coherent(device, CC_IVPOOL_META_SIZE,
&ivgen_ctx->pool_meta_dma, &ivgen_ctx->pool_meta_dma,
...@@ -200,6 +197,8 @@ int cc_ivgen_init(struct cc_drvdata *drvdata) ...@@ -200,6 +197,8 @@ int cc_ivgen_init(struct cc_drvdata *drvdata)
goto out; goto out;
} }
drvdata->ivgen_handle = ivgen_ctx;
return cc_init_iv_sram(drvdata); return cc_init_iv_sram(drvdata);
out: out:
......
...@@ -32,13 +32,16 @@ void cc_sram_mgr_fini(struct cc_drvdata *drvdata) ...@@ -32,13 +32,16 @@ void cc_sram_mgr_fini(struct cc_drvdata *drvdata)
*/ */
int cc_sram_mgr_init(struct cc_drvdata *drvdata) int cc_sram_mgr_init(struct cc_drvdata *drvdata)
{ {
struct cc_sram_ctx *ctx;
/* Allocate "this" context */ /* Allocate "this" context */
drvdata->sram_mgr_handle = kzalloc(sizeof(*drvdata->sram_mgr_handle), ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
GFP_KERNEL);
if (!drvdata->sram_mgr_handle) if (!ctx)
return -ENOMEM; return -ENOMEM;
drvdata->sram_mgr_handle = ctx;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册