From: Harald Freudenberger <freude@linux.vnet.ibm.com>
To: Vasyl Gomonovych <gomonovych@gmail.com>,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: freude@de.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com
Subject: Re: [PATCH] s390/pkey: fix kzalloc-simple.cocci warnings
Date: Fri, 13 Oct 2017 08:36:59 +0200 [thread overview]
Message-ID: <dc6cb53f-4f1d-988f-ec99-0344c5fc94f6@linux.vnet.ibm.com> (raw)
In-Reply-To: <1507751566-15948-1-git-send-email-gomonovych@gmail.com>
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
prev parent reply other threads:[~2017-10-13 6:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-11 19:52 [PATCH] s390/pkey: fix kzalloc-simple.cocci warnings Vasyl Gomonovych
2017-10-13 6:36 ` Harald Freudenberger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dc6cb53f-4f1d-988f-ec99-0344c5fc94f6@linux.vnet.ibm.com \
--to=freude@linux.vnet.ibm.com \
--cc=freude@de.ibm.com \
--cc=gomonovych@gmail.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox