linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ftrace: Modify parameter transfer type
Date: Tue, 30 Mar 2021 09:39:16 -0400	[thread overview]
Message-ID: <20210330093916.432697c7@gandalf.local.home> (raw)
In-Reply-To: <1617098546-41010-1-git-send-email-jiapeng.chong@linux.alibaba.com>

On Tue, 30 Mar 2021 18:02:26 +0800
Jiapeng Chong <jiapeng.chong@linux.alibaba.com> wrote:

> Fix the following whitescan warning:
> 
> "order" is passed to a parameter that cannot be negative.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  kernel/trace/ftrace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index b7e29db..bd42e86 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -6811,7 +6811,7 @@ void ftrace_free_mem(struct module *mod, void *start_ptr, void *end_ptr)
>  		if (!pg->index) {
>  			*last_pg = pg->next;
>  			order = get_count_order(pg->size / ENTRIES_PER_PAGE);
> -			free_pages((unsigned long)pg->records, order);
> +			free_pages((unsigned long)pg->records, (unsigned int)order);

NAK!

This "fix" actually makes the problem worse, and hides a possible bug.

-- Steve


>  			ftrace_number_of_pages -= 1 << order;
>  			ftrace_number_of_groups--;
>  			kfree(pg);


      reply	other threads:[~2021-03-30 13:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 10:02 [PATCH] ftrace: Modify parameter transfer type Jiapeng Chong
2021-03-30 13:39 ` Steven Rostedt [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=20210330093916.432697c7@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.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;
as well as URLs for NNTP newsgroup(s).