[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d0adc27d-0654-385b-0f07-2232aa65c576@huawei.com>
Date: Mon, 31 May 2021 08:54:15 +0800
From: Kefeng Wang <wangkefeng.wang@...wei.com>
To: <linux-kernel@...r.kernel.org>
CC: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>
Subject: Re: [PATCH] uprobes: Use better bitmap_zalloc()
sorry for the mistake, will fix.
On 2021/5/29 19:15, Kefeng Wang wrote:
> Use better bitmap_zalloc() to allocate bitmap.
>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Arnaldo Carvalho de Melo <acme@...nel.org>
> Cc: Mark Rutland <mark.rutland@....com>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@...wei.com>
> ---
> kernel/events/uprobes.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index 907d4ee00cb2..8160d2e53219 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -1487,8 +1487,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)
> if (unlikely(!area))
> goto out;
>
> - area->bitmap = kcalloc(BITS_TO_LONGS(UINSNS_PER_PAGE), sizeof(long),
> - GFP_KERNEL);
> + area->bitmap = bitmap_kzalloc(UINSNS_PER_PAGE, GFP_KERNEL);
> if (!area->bitmap)
> goto free_area;
>
> @@ -1512,7 +1511,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)
>
> __free_page(area->pages[0]);
> free_bitmap:
> - kfree(area->bitmap);
> + bitmap_kfree(area->bitmap);
> free_area:
> kfree(area);
> out:
> @@ -1553,7 +1552,7 @@ void uprobe_clear_state(struct mm_struct *mm)
> return;
>
> put_page(area->pages[0]);
> - kfree(area->bitmap);
> + bitmap_kfree(area->bitmap);
> kfree(area);
> }
>
Powered by blists - more mailing lists