mm/hmm: Fix calcuation of start address for unaddressable memory
Subsystems (2)
PATCH 1/1 mm/hmm: Fix calcuation of start address for unaddressable memory
The code used iomem_resource.end which is an odd number and hence the calculation then moves on to addr - size + 1. When the minimum is (1ULL << MAX_PHYSMEM_BITS), the calculation of start is broken. This patch changes the calculation so that addr is on the start of a PA_SECTION_SIZE boundary
Signed-off-by Balbir Singh <[email protected]>
--- mm/hmm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/hmm.c +2 -1
@@ -1022,7 +1022,8 @@ struct hmm_devmem *hmm_devmem_add(const struct hmm_devmem_ops *ops, goto error_devm_add_action; size =ALIGN (size,PA_SECTION_SIZE ); - addr =min ((unsigned long )iomem_resource.end,1UL <<MAX_PHYSMEM_BITS ); + addr =min ((unsigned long )iomem_resource.end, + (1UL <<MAX_PHYSMEM_BITS ) -1 ); addr = addr - size +1UL ;/*
Signature · 7 lines
2.9.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>