Skip to content

Commit 78a0e8c

Browse files
Christoph Hellwigtorvalds
authored andcommitted
mm: pass addr as unsigned long to vb_free
Ever use of addr in vb_free casts to unsigned long first, and the caller has an unsigned long version of the address available anyway. Just pass that and avoid all the casts. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: David Airlie <[email protected]> Cc: Gao Xiang <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Haiyang Zhang <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: "K. Y. Srinivasan" <[email protected]> Cc: Laura Abbott <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Michael Kelley <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Nitin Gupta <[email protected]> Cc: Robin Murphy <[email protected]> Cc: Sakari Ailus <[email protected]> Cc: Stephen Hemminger <[email protected]> Cc: Sumit Semwal <[email protected]> Cc: Wei Liu <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Will Deacon <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent b607e6d commit 78a0e8c

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

mm/vmalloc.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ static void *vb_alloc(unsigned long size, gfp_t gfp_mask)
16651665
return vaddr;
16661666
}
16671667

1668-
static void vb_free(const void *addr, unsigned long size)
1668+
static void vb_free(unsigned long addr, unsigned long size)
16691669
{
16701670
unsigned long offset;
16711671
unsigned long vb_idx;
@@ -1675,24 +1675,22 @@ static void vb_free(const void *addr, unsigned long size)
16751675
BUG_ON(offset_in_page(size));
16761676
BUG_ON(size > PAGE_SIZE*VMAP_MAX_ALLOC);
16771677

1678-
flush_cache_vunmap((unsigned long)addr, (unsigned long)addr + size);
1678+
flush_cache_vunmap(addr, addr + size);
16791679

16801680
order = get_order(size);
16811681

1682-
offset = (unsigned long)addr & (VMAP_BLOCK_SIZE - 1);
1683-
offset >>= PAGE_SHIFT;
1682+
offset = (addr & (VMAP_BLOCK_SIZE - 1)) >> PAGE_SHIFT;
16841683

1685-
vb_idx = addr_to_vb_idx((unsigned long)addr);
1684+
vb_idx = addr_to_vb_idx(addr);
16861685
rcu_read_lock();
16871686
vb = radix_tree_lookup(&vmap_block_tree, vb_idx);
16881687
rcu_read_unlock();
16891688
BUG_ON(!vb);
16901689

1691-
vunmap_page_range((unsigned long)addr, (unsigned long)addr + size);
1690+
vunmap_page_range(addr, addr + size);
16921691

16931692
if (debug_pagealloc_enabled_static())
1694-
flush_tlb_kernel_range((unsigned long)addr,
1695-
(unsigned long)addr + size);
1693+
flush_tlb_kernel_range(addr, addr + size);
16961694

16971695
spin_lock(&vb->lock);
16981696

@@ -1792,7 +1790,7 @@ void vm_unmap_ram(const void *mem, unsigned int count)
17921790

17931791
if (likely(count <= VMAP_MAX_ALLOC)) {
17941792
debug_check_no_locks_freed(mem, size);
1795-
vb_free(mem, size);
1793+
vb_free(addr, size);
17961794
return;
17971795
}
17981796

0 commit comments

Comments
 (0)