Sorry, the size here may be calculated according to this formula, cancel this patch At 2023-03-24 13:23:51, "Hongbin Ji" <jhb_ee@xxxxxxx> wrote: >When memblock users to specify range where @base + @size overflows >and automatically cap it at maximum, The new size should be >PHYS_ADDR_MAX - @base + 1. > >Assuming that base is 0, PHYS_ADDR_MAX is 0xff, which is 255 in decimal, >then @size should be 256 instead of 255 > >Signed-off-by: Hongbin Ji <jhb_ee@xxxxxxx> >--- > mm/memblock.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/mm/memblock.c b/mm/memblock.c >index 25fd0626a9e7..f1683d1dae65 100644 >--- a/mm/memblock.c >+++ b/mm/memblock.c >@@ -169,7 +169,7 @@ static enum memblock_flags __init_memblock choose_memblock_flags(void) > /* adjust *@size so that (@base + *@size) doesn't overflow, return new size */ > static inline phys_addr_t memblock_cap_size(phys_addr_t base, phys_addr_t *size) > { >- return *size = min(*size, PHYS_ADDR_MAX - base); >+ return *size = min(*size, PHYS_ADDR_MAX - base + 1); > } > > /* >-- >2.34.1