On Wed, Aug 14, 2024 at 12:29:36AM +0200, Thomas Gleixner wrote: > iounmap() on x86 occasionally fails to unmap because the provided valid > ioremap address is not below high_memory. It turned out that this > happens due to KASLR. > [ ... ] > > --- a/kernel/resource.c > +++ b/kernel/resource.c > @@ -1826,8 +1826,7 @@ static resource_size_t gfr_start(struct > if (flags & GFR_DESCENDING) { > resource_size_t end; > > - end = min_t(resource_size_t, base->end, > - (1ULL << MAX_PHYSMEM_BITS) - 1); > + end = min_t(resource_size_t, base->end, PHYSMEM_END); > return end - size + 1; > } When trying to build arm:allmodconfig or mips:allmodconfig (and probably others): Building arm:allmodconfig ... failed -------------- Error log: In file included from include/linux/ioport.h:15, from kernel/resource.c:15: kernel/resource.c: In function 'gfr_start': include/linux/minmax.h:93:37: error: conversion from 'long long unsigned int' to 'resource_size_t' {aka 'unsigned int'} changes value from '18446744073709551615' to '4294967295' [-Werror=overflow] 93 | ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); }) | ^ include/linux/minmax.h:96:9: note: in expansion of macro '__cmp_once_unique' 96 | __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) | ^~~~~~~~~~~~~~~~~ include/linux/minmax.h:213:27: note: in expansion of macro '__cmp_once' 213 | #define min_t(type, x, y) __cmp_once(min, type, x, y) | ^~~~~~~~~~ kernel/resource.c:1874:23: note: in expansion of macro 'min_t' 1874 | end = min_t(resource_size_t, base->end, PHYSMEM_END); | ^~~~~ kernel/resource.c: In function 'gfr_continue': include/linux/minmax.h:93:37: error: conversion from 'long long unsigned int' to 'resource_size_t' {aka 'unsigned int'} changes value from '18446744073709551615' to '4294967295' [-Werror=overflow] 93 | ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); }) | ^ include/linux/minmax.h:96:9: note: in expansion of macro '__cmp_once_unique' 96 | __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) | ^~~~~~~~~~~~~~~~~ include/linux/minmax.h:213:27: note: in expansion of macro '__cmp_once' 213 | #define min_t(type, x, y) __cmp_once(min, type, x, y) | ^~~~~~~~~~ kernel/resource.c:1891:24: note: in expansion of macro 'min_t' 1891 | addr <= min_t(resource_size_t, base->end, PHYSMEM_END); | ^~~~~ Guenter