mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing: Replace kzalloc with kcalloc
Date: Tue, 15 Jan 2019 15:16:20 -0600	[thread overview]
Message-ID: <659f9838-9e3f-2ba8-3b02-9f19192bc252@embeddedor.com> (raw)
In-Reply-To: <20190115161255.6afa9dbd@gandalf.local.home>



On 1/15/19 3:12 PM, Steven Rostedt wrote:
> On Mon, 14 Jan 2019 22:34:08 -0600
> "Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
> 
>> Replace kzalloc() function with its 2-factor argument form, kcalloc().
>>
>> This patch replaces cases of:
>>
>> 	kzalloc(a * b, gfp)
>>
>> with:
>> 	kcalloc(a * b, gfp)
> 
> I think you meant:
> 
> 	kcalloc(a, b, gfp)
> 

Yep. copy/paste error. :/

Thanks
--
Gustavo

> -- Steve
> 
>>
>> This code was detected with the help of Coccinelle.
>>
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> ---
>>   kernel/trace/trace_probe.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
>> index 9962cb5da8ac..57f0cbaf9c58 100644
>> --- a/kernel/trace/trace_probe.c
>> +++ b/kernel/trace/trace_probe.c
>> @@ -429,7 +429,7 @@ static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size,
>>   			 parg->count);
>>   	}
>>   
>> -	code = tmp = kzalloc(sizeof(*code) * FETCH_INSN_MAX, GFP_KERNEL);
>> +	code = tmp = kcalloc(FETCH_INSN_MAX, sizeof(*code), GFP_KERNEL);
>>   	if (!code)
>>   		return -ENOMEM;
>>   	code[FETCH_INSN_MAX - 1].op = FETCH_OP_END;
>> @@ -501,7 +501,7 @@ static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size,
>>   	code->op = FETCH_OP_END;
>>   
>>   	/* Shrink down the code buffer */
>> -	parg->code = kzalloc(sizeof(*code) * (code - tmp + 1), GFP_KERNEL);
>> +	parg->code = kcalloc(code - tmp + 1, sizeof(*code), GFP_KERNEL);
>>   	if (!parg->code)
>>   		ret = -ENOMEM;
>>   	else
> 

      reply	other threads:[~2019-01-15 21:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15  4:34 Gustavo A. R. Silva
2019-01-15 21:12 ` Steven Rostedt
2019-01-15 21:16   ` Gustavo A. R. Silva [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=659f9838-9e3f-2ba8-3b02-9f19192bc252@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /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

all inboxes | Powered by JetHome®