2021-06-22 22:39:52

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build warning after merge of the kspp-gustavo tree

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


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2021-06-22 23:09:30

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: linux-next: build warning after merge of the kspp-gustavo tree

Hi Stephen,

I will remove that commit and work on fixing those issues before
trying again.

Thanks for the report!
--
Gustavo

On 6/22/21 17:39, Stephen Rothwell wrote:
> 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")
>

2021-06-22 23:46:43

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: linux-next: build warning after merge of the kspp-gustavo tree



On 6/22/21 17:46, Gustavo A. R. Silva wrote:
> Hi Stephen,
>
> I will remove that commit and work on fixing those issues before
> trying again.

Done:

I just removed commit 8d7900f545f1 ("Makefile: Enable -Warray-bounds"):

https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/log/?h=for-next/kspp

Sorry for the noise.

Thanks
--
Gustavo

>
> Thanks for the report!
> --
> Gustavo
>
> On 6/22/21 17:39, Stephen Rothwell wrote:
>> 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")
>>

2021-06-23 03:04:34

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build warning after merge of the kspp-gustavo tree

Hi Gustavo,

On Tue, 22 Jun 2021 18:01:02 -0500 "Gustavo A. R. Silva" <[email protected]> wrote:
>
> On 6/22/21 17:46, Gustavo A. R. Silva wrote:
> > Hi Stephen,
> >
> > I will remove that commit and work on fixing those issues before
> > trying again.
>
> Done:
>
> I just removed commit 8d7900f545f1 ("Makefile: Enable -Warray-bounds"):

I have also reverted it from linux-next today.

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2021-06-23 13:21:52

by David Sterba

[permalink] [raw]
Subject: Re: linux-next: build warning after merge of the kspp-gustavo tree

On Wed, Jun 23, 2021 at 08:39:01AM +1000, Stephen Rothwell wrote:
> 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]); \
> | ~~~~~~~~~~~~~~~~^~~~~~~~~

The warning is correct, on powerpc and 64k pages the array has only 1
item, ie. only index 0 is valid. The overflow won't happen in practice
though because of previous branch that would happen in 100% cases. The
code handles when some bytes cross 2 pages but on 64k pages it's all
just one page.

To allow the warning to be enabled globally we'll fix it, I'll let
Gustavo know once it's done.

2021-06-23 19:03:21

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: linux-next: build warning after merge of the kspp-gustavo tree



On 6/23/21 08:14, David Sterba wrote:
> On Wed, Jun 23, 2021 at 08:39:01AM +1000, Stephen Rothwell wrote:
>> 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]); \
>> | ~~~~~~~~~~~~~~~~^~~~~~~~~
>
> The warning is correct, on powerpc and 64k pages the array has only 1
> item, ie. only index 0 is valid. The overflow won't happen in practice
> though because of previous branch that would happen in 100% cases. The
> code handles when some bytes cross 2 pages but on 64k pages it's all
> just one page.
>
> To allow the warning to be enabled globally we'll fix it, I'll let
> Gustavo know once it's done.

Awesome. :)

Thanks, David.
--
Gustavo