lkml.org 
[lkml]   [2017]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] s390/pkey: fix kzalloc-simple.cocci warnings
From
Date
On 10/11/2017 09:52 PM, Vasyl Gomonovych wrote:
> drivers/s390/crypto/pkey_api.c:128:11-18: WARNING: kzalloc should be used for cprbmem, instead of kmalloc/memset
>
> Use kzalloc rather than kmalloc followed by memset with 0
>
> Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
>
> Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>
> ---
> drivers/s390/crypto/pkey_api.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
> index f61fa47..8dda5bb 100644
> --- a/drivers/s390/crypto/pkey_api.c
> +++ b/drivers/s390/crypto/pkey_api.c
> @@ -125,10 +125,9 @@ static int alloc_and_prep_cprbmem(size_t paramblen,
> * allocate consecutive memory for request CPRB, request param
> * block, reply CPRB and reply param block
> */
> - cprbmem = kmalloc(2 * cprbplusparamblen, GFP_KERNEL);
> + cprbmem = kzalloc(2 * cprbplusparamblen, GFP_KERNEL);
> if (!cprbmem)
> return -ENOMEM;
> - memset(cprbmem, 0, 2 * cprbplusparamblen);
>
> preqcblk = (struct CPRBX *) cprbmem;
> prepcblk = (struct CPRBX *) (cprbmem + cprbplusparamblen);
applied, will be available with the next merge window.
Thanks

\
 
 \ /
  Last update: 2017-10-13 08:37    [W:0.065 / U:0.116 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site