Subject: linux-next: build warning after merge of the kspp-gustavo tree

From: Stephen Rothwell <[email-masked]>
Date: Wed, 23 Jun 2021 08:39:01 +1000

Hi all,

After merging the kspp-gustavo tree, today's linux-next build (powerpc
ppc64_defconfig) produced this warning:

In file included from fs/btrfs/ctree.h:9,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/struct-funcs.c: In function 'btrfs_get_token_16':
fs/btrfs/struct-funcs.c:80:46: warning: array subscript 1 is above array bounds of 'struct page *[1]' [-Warray-bounds]
   80 |  token->kaddr = page_address(token->eb->pages[idx + 1]);  \
      |                              ~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/mm.h:1627:48: note: in definition of macro 'page_address'
 1627 | #define page_address(page) lowmem_page_address(page)
      |                                                ^~~~
fs/btrfs/struct-funcs.c:161:1: note: in expansion of macro 'DEFINE_BTRFS_SETGET_BITS'
  161 | DEFINE_BTRFS_SETGET_BITS(16)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/btrfs/ctree.h:32,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/extent_io.h:97:15: note: while referencing 'pages'
   97 |  struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
      |               ^~~~~
In file included from fs/btrfs/ctree.h:9,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/struct-funcs.c: In function 'btrfs_get_16':
fs/btrfs/struct-funcs.c:101:32: warning: array subscript 1 is above array bounds of 'struct page * const[1]' [-Warray-bounds]
  101 |  kaddr = page_address(eb->pages[idx + 1]);   \
      |                       ~~~~~~~~~^~~~~~~~~
include/linux/mm.h:1627:48: note: in definition of macro 'page_address'
 1627 | #define page_address(page) lowmem_page_address(page)
      |                                                ^~~~
fs/btrfs/struct-funcs.c:161:1: note: in expansion of macro 'DEFINE_BTRFS_SETGET_BITS'
  161 | DEFINE_BTRFS_SETGET_BITS(16)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/btrfs/ctree.h:32,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/extent_io.h:97:15: note: while referencing 'pages'
   97 |  struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
      |               ^~~~~
In file included from fs/btrfs/ctree.h:9,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/struct-funcs.c: In function 'btrfs_set_token_16':
fs/btrfs/struct-funcs.c:133:46: warning: array subscript 1 is above array bounds of 'struct page *[1]' [-Warray-bounds]
  133 |  token->kaddr = page_address(token->eb->pages[idx + 1]);  \
      |                              ~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/mm.h:1627:48: note: in definition of macro 'page_address'
 1627 | #define page_address(page) lowmem_page_address(page)
      |                                                ^~~~
fs/btrfs/struct-funcs.c:161:1: note: in expansion of macro 'DEFINE_BTRFS_SETGET_BITS'
  161 | DEFINE_BTRFS_SETGET_BITS(16)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/btrfs/ctree.h:32,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/extent_io.h:97:15: note: while referencing 'pages'
   97 |  struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
      |               ^~~~~
In file included from fs/btrfs/ctree.h:9,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/struct-funcs.c: In function 'btrfs_set_16':
fs/btrfs/struct-funcs.c:156:32: warning: array subscript 1 is above array bounds of 'struct page * const[1]' [-Warray-bounds]
  156 |  kaddr = page_address(eb->pages[idx + 1]);   \
      |                       ~~~~~~~~~^~~~~~~~~
include/linux/mm.h:1627:48: note: in definition of macro 'page_address'
 1627 | #define page_address(page) lowmem_page_address(page)
      |                                                ^~~~
fs/btrfs/struct-funcs.c:161:1: note: in expansion of macro 'DEFINE_BTRFS_SETGET_BITS'
  161 | DEFINE_BTRFS_SETGET_BITS(16)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/btrfs/ctree.h:32,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/extent_io.h:97:15: note: while referencing 'pages'
   97 |  struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
      |               ^~~~~
In file included from fs/btrfs/ctree.h:9,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/struct-funcs.c: In function 'btrfs_get_token_32':
fs/btrfs/struct-funcs.c:80:46: warning: array subscript 1 is above array bounds of 'struct page *[1]' [-Warray-bounds]
   80 |  token->kaddr = page_address(token->eb->pages[idx + 1]);  \
      |                              ~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/mm.h:1627:48: note: in definition of macro 'page_address'
 1627 | #define page_address(page) lowmem_page_address(page)
      |                                                ^~~~
fs/btrfs/struct-funcs.c:162:1: note: in expansion of macro 'DEFINE_BTRFS_SETGET_BITS'
  162 | DEFINE_BTRFS_SETGET_BITS(32)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/btrfs/ctree.h:32,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/extent_io.h:97:15: note: while referencing 'pages'
   97 |  struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
      |               ^~~~~
In file included from fs/btrfs/ctree.h:9,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/struct-funcs.c: In function 'btrfs_get_32':
fs/btrfs/struct-funcs.c:101:32: warning: array subscript 1 is above array bounds of 'struct page * const[1]' [-Warray-bounds]
  101 |  kaddr = page_address(eb->pages[idx + 1]);   \
      |                       ~~~~~~~~~^~~~~~~~~
include/linux/mm.h:1627:48: note: in definition of macro 'page_address'
 1627 | #define page_address(page) lowmem_page_address(page)
      |                                                ^~~~
fs/btrfs/struct-funcs.c:162:1: note: in expansion of macro 'DEFINE_BTRFS_SETGET_BITS'
  162 | DEFINE_BTRFS_SETGET_BITS(32)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/btrfs/ctree.h:32,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/extent_io.h:97:15: note: while referencing 'pages'
   97 |  struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
      |               ^~~~~
In file included from fs/btrfs/ctree.h:9,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/struct-funcs.c: In function 'btrfs_set_token_32':
fs/btrfs/struct-funcs.c:133:46: warning: array subscript 1 is above array bounds of 'struct page *[1]' [-Warray-bounds]
  133 |  token->kaddr = page_address(token->eb->pages[idx + 1]);  \
      |                              ~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/mm.h:1627:48: note: in definition of macro 'page_address'
 1627 | #define page_address(page) lowmem_page_address(page)
      |                                                ^~~~
fs/btrfs/struct-funcs.c:162:1: note: in expansion of macro 'DEFINE_BTRFS_SETGET_BITS'
  162 | DEFINE_BTRFS_SETGET_BITS(32)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/btrfs/ctree.h:32,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/extent_io.h:97:15: note: while referencing 'pages'
   97 |  struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
      |               ^~~~~
In file included from fs/btrfs/ctree.h:9,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/struct-funcs.c: In function 'btrfs_set_32':
fs/btrfs/struct-funcs.c:156:32: warning: array subscript 1 is above array bounds of 'struct page * const[1]' [-Warray-bounds]
  156 |  kaddr = page_address(eb->pages[idx + 1]);   \
      |                       ~~~~~~~~~^~~~~~~~~
include/linux/mm.h:1627:48: note: in definition of macro 'page_address'
 1627 | #define page_address(page) lowmem_page_address(page)
      |                                                ^~~~
fs/btrfs/struct-funcs.c:162:1: note: in expansion of macro 'DEFINE_BTRFS_SETGET_BITS'
  162 | DEFINE_BTRFS_SETGET_BITS(32)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/btrfs/ctree.h:32,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/extent_io.h:97:15: note: while referencing 'pages'
   97 |  struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
      |               ^~~~~
In file included from fs/btrfs/ctree.h:9,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/struct-funcs.c: In function 'btrfs_get_token_64':
fs/btrfs/struct-funcs.c:80:46: warning: array subscript 1 is above array bounds of 'struct page *[1]' [-Warray-bounds]
   80 |  token->kaddr = page_address(token->eb->pages[idx + 1]);  \
      |                              ~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/mm.h:1627:48: note: in definition of macro 'page_address'
 1627 | #define page_address(page) lowmem_page_address(page)
      |                                                ^~~~
fs/btrfs/struct-funcs.c:163:1: note: in expansion of macro 'DEFINE_BTRFS_SETGET_BITS'
  163 | DEFINE_BTRFS_SETGET_BITS(64)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/btrfs/ctree.h:32,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/extent_io.h:97:15: note: while referencing 'pages'
   97 |  struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
      |               ^~~~~
In file included from fs/btrfs/ctree.h:9,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/struct-funcs.c: In function 'btrfs_get_64':
fs/btrfs/struct-funcs.c:101:32: warning: array subscript 1 is above array bounds of 'struct page * const[1]' [-Warray-bounds]
  101 |  kaddr = page_address(eb->pages[idx + 1]);   \
      |                       ~~~~~~~~~^~~~~~~~~
include/linux/mm.h:1627:48: note: in definition of macro 'page_address'
 1627 | #define page_address(page) lowmem_page_address(page)
      |                                                ^~~~
fs/btrfs/struct-funcs.c:163:1: note: in expansion of macro 'DEFINE_BTRFS_SETGET_BITS'
  163 | DEFINE_BTRFS_SETGET_BITS(64)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/btrfs/ctree.h:32,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/extent_io.h:97:15: note: while referencing 'pages'
   97 |  struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
      |               ^~~~~
In file included from fs/btrfs/ctree.h:9,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/struct-funcs.c: In function 'btrfs_set_token_64':
fs/btrfs/struct-funcs.c:133:46: warning: array subscript 1 is above array bounds of 'struct page *[1]' [-Warray-bounds]
  133 |  token->kaddr = page_address(token->eb->pages[idx + 1]);  \
      |                              ~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/mm.h:1627:48: note: in definition of macro 'page_address'
 1627 | #define page_address(page) lowmem_page_address(page)
      |                                                ^~~~
fs/btrfs/struct-funcs.c:163:1: note: in expansion of macro 'DEFINE_BTRFS_SETGET_BITS'
  163 | DEFINE_BTRFS_SETGET_BITS(64)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/btrfs/ctree.h:32,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/extent_io.h:97:15: note: while referencing 'pages'
   97 |  struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
      |               ^~~~~
In file included from fs/btrfs/ctree.h:9,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/struct-funcs.c: In function 'btrfs_set_64':
fs/btrfs/struct-funcs.c:156:32: warning: array subscript 1 is above array bounds of 'struct page * const[1]' [-Warray-bounds]
  156 |  kaddr = page_address(eb->pages[idx + 1]);   \
      |                       ~~~~~~~~~^~~~~~~~~
include/linux/mm.h:1627:48: note: in definition of macro 'page_address'
 1627 | #define page_address(page) lowmem_page_address(page)
      |                                                ^~~~
fs/btrfs/struct-funcs.c:163:1: note: in expansion of macro 'DEFINE_BTRFS_SETGET_BITS'
  163 | DEFINE_BTRFS_SETGET_BITS(64)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/btrfs/ctree.h:32,
                 from fs/btrfs/struct-funcs.c:8:
fs/btrfs/extent_io.h:97:15: note: while referencing 'pages'
   97 |  struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
      |               ^~~~~
In file included from include/linux/bvec.h:14,
                 from include/linux/blk_types.h:10,
                 from include/linux/genhd.h:19,
                 from include/linux/blkdev.h:8,
                 from fs/btrfs/disk-io.c:7:
fs/btrfs/disk-io.c: In function 'csum_tree_block':
fs/btrfs/disk-io.c:225:34: warning: array subscript 1 is above array bounds of 'struct page *[1]' [-Warray-bounds]
  225 |   kaddr = page_address(buf->pages[i]);
      |                        ~~~~~~~~~~^~~
include/linux/mm.h:1627:48: note: in definition of macro 'page_address'
 1627 | #define page_address(page) lowmem_page_address(page)
      |                                                ^~~~
In file included from fs/btrfs/ctree.h:32,
                 from fs/btrfs/disk-io.c:22:
fs/btrfs/extent_io.h:97:15: note: while referencing 'pages'
   97 |  struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
      |               ^~~~~

Introduced by commit

  8d7900f545f1 ("Makefile: Enable -Warray-bounds")

-- 
Cheers,
Stephen Rothwell