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 <bsingharora@xxxxxxxxx> --- mm/hmm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/hmm.c b/mm/hmm.c index 34e1325..cc6d25c 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -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; /* -- 2.9.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>