Re: [ammarfaizi2-block:dhowells/linux-fs/netfs-linked-list 29/57] include/linux/page-flags.h:788:27: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type

From: Muchun Song
Date: Sat Jun 11 2022 - 11:37:59 EST


On Sat, Jun 11, 2022 at 11:19 AM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> tree: https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/netfs-linked-list
> head: c19d336b7f0c53bd31e73f6d7d6c1524f0df55b8
> commit: f951c9604853872cf088bb3dbf7d49e3f96b090d [29/57] mm: Make some folio function arguments const
> config: i386-randconfig-a001 (https://download.01.org/0day-ci/archive/20220611/202206111120.hjvhr7ho-lkp@xxxxxxxxx/config)
> compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
> reproduce (this is a W=1 build):
> # https://github.com/ammarfaizi2/linux-block/commit/f951c9604853872cf088bb3dbf7d49e3f96b090d
> git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
> git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/netfs-linked-list
> git checkout f951c9604853872cf088bb3dbf7d49e3f96b090d
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> make W=1 O=build_dir ARCH=i386 prepare
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All warnings (new ones prefixed by >>):
>
> In file included from include/linux/gfp.h:5,
> from include/linux/slab.h:15,
> from include/linux/crypto.h:20,
> from arch/x86/kernel/asm-offsets.c:9:
> include/linux/page-flags.h: In function 'PageHead':
> >> include/linux/page-flags.h:788:27: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
> 788 | PF_POISONED_CHECK(page);
> | ^~~~
> include/linux/mmdebug.h:21:35: note: in definition of macro 'VM_BUG_ON_PAGE'
> 21 | dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\

A lot of places which need to be fixed since dump_page() calls lots of helpers
which do not declare the "struct page *" as "const struct page *".
e.g. page_mapcount(),
PageKsm(), PageAnon(), page_to_pgoff(), PageCompound(), etc.

Thanks.