[PATCH] uprobe: switch to bitmap_zalloc() in __create_xol_area()

From: Yunfeng Ye
Date: Sat May 16 2020 - 06:11:43 EST


Switch to bitmap_zalloc() to show clearly in __create_xol_area().

No functional change.

Signed-off-by: Yunfeng Ye <yeyunfeng@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 ece7e13f6e4a..1d3dde9101b0 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1490,8 +1490,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_zalloc(UINSNS_PER_PAGE, GFP_KERNEL);
if (!area->bitmap)
goto free_area;

@@ -1515,7 +1514,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)

__free_page(area->pages[0]);
free_bitmap:
- kfree(area->bitmap);
+ bitmap_free(area->bitmap);
free_area:
kfree(area);
out:
@@ -1556,7 +1555,7 @@ void uprobe_clear_state(struct mm_struct *mm)
return;

put_page(area->pages[0]);
- kfree(area->bitmap);
+ bitmap_free(area->bitmap);
kfree(area);
}

--
1.8.3.1