[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210529111553.186630-1-wangkefeng.wang@huawei.com>
Date: Sat, 29 May 2021 19:15:53 +0800
From: Kefeng Wang <wangkefeng.wang@...wei.com>
To: <linux-kernel@...r.kernel.org>
CC: Kefeng Wang <wangkefeng.wang@...wei.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
"Arnaldo Carvalho de Melo" <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>
Subject: [PATCH] uprobes: Use better bitmap_zalloc()
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);
}
--
2.26.2
Powered by blists - more mailing lists