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

From: Gustavo A. R. Silva
Date: Wed Jun 23 2021 - 15:02:04 EST




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