Use better bitmap_zalloc() to allocate bitmap.
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Mark Rutland <mark.rutland@xxxxxxx>
Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx>
---
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);
}