FAILED: patch "[PATCH] stating: ccree: fix allocation of void sized buf" failed to apply to 4.15-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
2392b84fb2f8daf71e70dd13101ec70ff636a3d3Mon Sep 17 00:00:00 2001
From: Gilad Ben-Yossef <[email protected]>
Date: Sun, 7 Jan 2018 12:14:34 +0000
Subject: [PATCH] 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.
Signed-off-by Gilad Ben-Yossef <[email protected]>
Signed-off-by Greg Kroah-Hartman <[email protected]>
drivers/staging/ccree/ssi_ivgen.c +4 -5
@@ -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:
drivers/staging/ccree/ssi_sram_mgr.c +6 -3
@@ -32,13 +32,16 @@ void cc_sram_mgr_fini(struct cc_drvdata *drvdata)*/ int cc_sram_mgr_init (struct cc_drvdata *drvdata) { +struct cc_sram_ctx *ctx; +/* Allocate "this" context */ - drvdata->sram_mgr_handle =kzalloc (sizeof (*drvdata->sram_mgr_handle), -GFP_KERNEL ); + ctx =kzalloc (sizeof (*ctx),GFP_KERNEL ); -if (!drvdata->sram_mgr_handle) +if (!ctx)return -ENOMEM ; + drvdata->sram_mgr_handle = ctx; +return 0 ; }