2020-05-16 10:12:45

by Yunfeng Ye

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

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

No functional change.

Signed-off-by: Yunfeng Ye <[email protected]>
---
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