mm: page_alloc: fix building error on -Werror=array-compare 59/292559/1
authorXiongwei Song <sxwjean@gmail.com>
Fri, 14 Jan 2022 22:07:24 +0000 (14:07 -0800)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 8 May 2023 09:34:29 +0000 (18:34 +0900)
commitfa2c1f7935131363cfb14d3c009327128a17a53f
treee127dae512616a400e2088dc5f6dd61517cfc90e
parentebb7cd06adb7b6635ccd5173ec3b00df0c2e09bc
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>
[sw0312.kim: cherry-pick stable linux-4.9.y commit 27057333467c to resolve gcc-12 build issue]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ifd2e97713a205497b95d26ee20a248b63dd0104b
mm/page_alloc.c