2022-06-11 05:47:14

by kernel test robot

[permalink] [raw]
Subject: [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

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/[email protected]/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 <[email protected]>

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)")");\
| ^~~~
include/linux/page-flags.h:370:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS'
370 | VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \
| ^~~~~~~~~~~~~~~~~
include/linux/page-flags.h:788:9: note: in expansion of macro 'PF_POISONED_CHECK'
788 | PF_POISONED_CHECK(page);
| ^~~~~~~~~~~~~~~~~
include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *'
12 | void dump_page(struct page *page, const char *reason);
| ~~~~~~~~~~~~~^~~~
--
In file included from include/linux/percpu.h:5,
from include/linux/hrtimer.h:19,
from include/linux/sched.h:19,
from include/linux/ptrace.h:6,
from lib/syscall.c:2:
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)")");\
| ^~~~
include/linux/page-flags.h:370:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS'
370 | VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \
| ^~~~~~~~~~~~~~~~~
include/linux/page-flags.h:788:9: note: in expansion of macro 'PF_POISONED_CHECK'
788 | PF_POISONED_CHECK(page);
| ^~~~~~~~~~~~~~~~~
include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *'
12 | void dump_page(struct page *page, const char *reason);
| ~~~~~~~~~~~~~^~~~
In file included from include/linux/string.h:253,
from arch/x86/include/asm/page_32.h:22,
from arch/x86/include/asm/page.h:14,
from arch/x86/include/asm/thread_info.h:12,
from include/linux/thread_info.h:60,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:78,
from include/linux/rcupdate.h:27,
from include/linux/rculist.h:11,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/ptrace.h:6,
from lib/syscall.c:2:
In function 'fortify_memcpy_chk',
inlined from 'syscall_get_arguments' at arch/x86/include/asm/syscall.h:87:2,
inlined from 'collect_syscall' at lib/syscall.c:31:3:
include/linux/fortify-string.h:352:25: warning: call to '__read_overflow2_field' declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Wattribute-warning]
352 | __read_overflow2_field(q_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
In file included from include/linux/gfp.h:5,
from include/linux/xarray.h:15,
from include/linux/list_lru.h:14,
from include/linux/fs.h:13,
from include/linux/decompress/mm.h:80,
from lib/decompress_inflate.c:32:
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)")");\
| ^~~~
include/linux/page-flags.h:370:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS'
370 | VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \
| ^~~~~~~~~~~~~~~~~
include/linux/page-flags.h:788:9: note: in expansion of macro 'PF_POISONED_CHECK'
788 | PF_POISONED_CHECK(page);
| ^~~~~~~~~~~~~~~~~
include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *'
12 | void dump_page(struct page *page, const char *reason);
| ~~~~~~~~~~~~~^~~~
lib/decompress_inflate.c: At top level:
lib/decompress_inflate.c:42:17: warning: no previous prototype for '__gunzip' [-Wmissing-prototypes]
42 | STATIC int INIT __gunzip(unsigned char *buf, long len,
| ^~~~~~~~
--
In file included from include/linux/gfp.h:5,
from include/linux/xarray.h:15,
from include/linux/list_lru.h:14,
from include/linux/fs.h:13,
from include/linux/decompress/mm.h:80,
from lib/decompress_unxz.c:107:
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)")");\
| ^~~~
include/linux/page-flags.h:370:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS'
370 | VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \
| ^~~~~~~~~~~~~~~~~
include/linux/page-flags.h:788:9: note: in expansion of macro 'PF_POISONED_CHECK'
788 | PF_POISONED_CHECK(page);
| ^~~~~~~~~~~~~~~~~
include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *'
12 | void dump_page(struct page *page, const char *reason);
| ~~~~~~~~~~~~~^~~~
lib/decompress_unxz.c: At top level:
lib/decompress_unxz.c:251:17: warning: no previous prototype for 'unxz' [-Wmissing-prototypes]
251 | STATIC int INIT unxz(unsigned char *in, long in_size,
| ^~~~
--
In file included from include/linux/percpu.h:5,
from include/linux/hrtimer.h:19,
from include/linux/sched.h:19,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/node.h:18,
from include/linux/cpu.h:17,
from lib/radix-tree.c:15:
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)")");\
| ^~~~
include/linux/page-flags.h:370:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS'
370 | VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \
| ^~~~~~~~~~~~~~~~~
include/linux/page-flags.h:788:9: note: in expansion of macro 'PF_POISONED_CHECK'
788 | PF_POISONED_CHECK(page);
| ^~~~~~~~~~~~~~~~~
include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *'
12 | void dump_page(struct page *page, const char *reason);
| ~~~~~~~~~~~~~^~~~
lib/radix-tree.c: At top level:
lib/radix-tree.c:288:6: warning: no previous prototype for 'radix_tree_node_rcu_free' [-Wmissing-prototypes]
288 | void radix_tree_node_rcu_free(struct rcu_head *head)
| ^~~~~~~~~~~~~~~~~~~~~~~~
--
In file included from include/linux/gfp.h:5,
from include/linux/radix-tree.h:12,
from include/linux/idr.h:15,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/of.h:17,
from include/linux/clk-provider.h:9,
from lib/vsprintf.c:23:
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)")");\
| ^~~~
include/linux/page-flags.h:370:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS'
370 | VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \
| ^~~~~~~~~~~~~~~~~
include/linux/page-flags.h:788:9: note: in expansion of macro 'PF_POISONED_CHECK'
788 | PF_POISONED_CHECK(page);
| ^~~~~~~~~~~~~~~~~
include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *'
12 | void dump_page(struct page *page, const char *reason);
| ~~~~~~~~~~~~~^~~~
lib/vsprintf.c: In function 'va_format':
lib/vsprintf.c:1681:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
1681 | buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
| ^~~
--
In file included from include/linux/gfp.h:5,
from include/linux/radix-tree.h:12,
from include/linux/idr.h:15,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/of.h:17,
from include/linux/irqdomain.h:35,
from include/linux/acpi.h:13,
from drivers/i2c/busses/i2c-cros-ec-tunnel.c:6:
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)")");\
| ^~~~
include/linux/page-flags.h:370:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS'
370 | VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \
| ^~~~~~~~~~~~~~~~~
include/linux/page-flags.h:788:9: note: in expansion of macro 'PF_POISONED_CHECK'
788 | PF_POISONED_CHECK(page);
| ^~~~~~~~~~~~~~~~~
include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *'
12 | void dump_page(struct page *page, const char *reason);
| ~~~~~~~~~~~~~^~~~
At top level:
drivers/i2c/busses/i2c-cros-ec-tunnel.c:295:34: warning: 'cros_ec_i2c_of_match' defined but not used [-Wunused-const-variable=]
295 | static const struct of_device_id cros_ec_i2c_of_match[] = {
| ^~~~~~~~~~~~~~~~~~~~
--
In file included from include/linux/gfp.h:5,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:17,
from lib/lz4/lz4_decompress.c:39:
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)")");\
| ^~~~
include/linux/page-flags.h:370:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS'
370 | VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \
| ^~~~~~~~~~~~~~~~~
include/linux/page-flags.h:788:9: note: in expansion of macro 'PF_POISONED_CHECK'
788 | PF_POISONED_CHECK(page);
| ^~~~~~~~~~~~~~~~~
include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *'
12 | void dump_page(struct page *page, const char *reason);
| ~~~~~~~~~~~~~^~~~
lib/lz4/lz4_decompress.c: At top level:
lib/lz4/lz4_decompress.c:510:5: warning: no previous prototype for 'LZ4_decompress_safe_forceExtDict' [-Wmissing-prototypes]
510 | int LZ4_decompress_safe_forceExtDict(const char *source, char *dest,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
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)")");\
| ^~~~
include/linux/page-flags.h:370:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS'
370 | VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \
| ^~~~~~~~~~~~~~~~~
include/linux/page-flags.h:788:9: note: in expansion of macro 'PF_POISONED_CHECK'
788 | PF_POISONED_CHECK(page);
| ^~~~~~~~~~~~~~~~~
include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *'
12 | void dump_page(struct page *page, const char *reason);
| ~~~~~~~~~~~~~^~~~


vim +788 include/linux/page-flags.h

e7d324850bfcb3 Muchun Song 2022-03-22 785
f951c960485387 David Howells 2022-06-08 786 static __always_inline int PageHead(const struct page *page)
e7d324850bfcb3 Muchun Song 2022-03-22 787 {
e7d324850bfcb3 Muchun Song 2022-03-22 @788 PF_POISONED_CHECK(page);
e7d324850bfcb3 Muchun Song 2022-03-22 789 return test_bit(PG_head, &page->flags) && !page_is_fake_head(page);
e7d324850bfcb3 Muchun Song 2022-03-22 790 }
e7d324850bfcb3 Muchun Song 2022-03-22 791

:::::: The code at line 788 was first introduced by commit
:::::: e7d324850bfcb30df563d144c0363cc44595277d mm: hugetlb: free the 2nd vmemmap page associated with each HugeTLB page

:::::: TO: Muchun Song <[email protected]>
:::::: CC: Linus Torvalds <[email protected]>

--
0-DAY CI Kernel Test Service
https://01.org/lkp


2022-06-11 15:54:57

by Muchun Song

[permalink] [raw]
Subject: 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

On Sat, Jun 11, 2022 at 11:19 AM kernel test robot <[email protected]> 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/[email protected]/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 <[email protected]>
>
> 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.