From 289934fc24519727ea3ceb2f6c2c315839098214 Mon Sep 17 00:00:00 2001 From: "Mike Rapoport (Microsoft)" Date: Wed, 20 May 2026 11:15:52 +0300 Subject: [PATCH] block: partitions: replace __get_free_page() with kmalloc() check_partition() allocates a buffer to use as backing buffer for seq_buf. This buffer can be allocated with kmalloc() as there's nothing special about it to go directly to the page allocator. Replace use of __get_free_page() with kmalloc() and free_page() with kfree(). Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com Signed-off-by: Mike Rapoport (Microsoft) --- block/partitions/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/partitions/core.c b/block/partitions/core.c index 5d5332ce586b6..b5c59b79ca7cb 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -124,7 +124,7 @@ static struct parsed_partitions *check_partition(struct gendisk *hd) state = allocate_partitions(hd); if (!state) return NULL; - state->pp_buf.buffer = (char *)__get_free_page(GFP_KERNEL); + state->pp_buf.buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!state->pp_buf.buffer) { free_partitions(state); return NULL; @@ -154,7 +154,7 @@ static struct parsed_partitions *check_partition(struct gendisk *hd) if (res > 0) { printk(KERN_INFO "%s", seq_buf_str(&state->pp_buf)); - free_page((unsigned long)state->pp_buf.buffer); + kfree(state->pp_buf.buffer); return state; } if (state->access_beyond_eod) @@ -170,7 +170,7 @@ static struct parsed_partitions *check_partition(struct gendisk *hd) printk(KERN_INFO "%s", seq_buf_str(&state->pp_buf)); } - free_page((unsigned long)state->pp_buf.buffer); + kfree(state->pp_buf.buffer); free_partitions(state); return ERR_PTR(res); }