diff options
author | Xiongwei Song <sxwjean@gmail.com> | 2022-01-14 14:07:24 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-04-27 13:15:29 +0200 |
commit | a148698a406bc4472b0af3e9d97a98aaade2c0d8 (patch) | |
tree | d13639fdae9ac63f3609374d4e9d9952ad9ab7f1 | |
parent | ab4d82d4d94f649721b0460948d747a0a5b88ee0 (diff) | |
download | linux-stable-a148698a406bc4472b0af3e9d97a98aaade2c0d8.tar.gz linux-stable-a148698a406bc4472b0af3e9d97a98aaade2c0d8.tar.bz2 linux-stable-a148698a406bc4472b0af3e9d97a98aaade2c0d8.zip |
mm: page_alloc: fix building error on -Werror=array-compare
commit ca831f29f8f25c97182e726429b38c0802200c8f upstream.
Arthur Marsh reported we would hit the error below when building kernel
with gcc-12:
CC mm/page_alloc.o
mm/page_alloc.c: In function `mem_init_print_info':
mm/page_alloc.c:8173:27: error: comparison between two arrays [-Werror=array-compare]
8173 | if (start <= pos && pos < end && size > adj) \
|
In C++20, the comparision between arrays should be warned.
Link: https://lkml.kernel.org/r/20211125130928.32465-1-sxwjean@me.com
Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
Reported-by: Arthur Marsh <arthur.marsh@internode.on.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | mm/page_alloc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e3d205f2a3ff..bfbccc739332 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6737,7 +6737,7 @@ void __init mem_init_print_info(const char *str) */ #define adj_init_size(start, end, size, pos, adj) \ do { \ - if (start <= pos && pos < end && size > adj) \ + if (&start[0] <= &pos[0] && &pos[0] < &end[0] && size > adj) \ size -= adj; \ } while (0) |