]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: add special case to setget helpers for 64k pages
authorDavid Sterba <dsterba@suse.com>
Wed, 23 Jun 2021 13:48:53 +0000 (15:48 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 23 Aug 2021 11:18:58 +0000 (13:18 +0200)
commite173a8c0fc66f6c34cd682c0d4bbe00e54fe4ae5
tree23d73afbae8de32b3f9619b8640c52272bf8dabd
parent33944d434fb097990dd8f3a9bdf986fe376f5ee7
btrfs: add special case to setget helpers for 64k pages

On 64K pages the size of the extent_buffer::pages array is 1 and
compilation with -Warray-bounds warns due to

  kaddr = page_address(eb->pages[idx + 1]);

when reading byte range crossing page boundary.

This does never actually overflow the array because on 64K because all
the data fit in one page and bounds are checked by check_setget_bounds.

To fix the reported overflows and warnings add a compile-time condition
that will allow compiler to eliminate the dead code that reads from the
idx + 1 page.

Link: https://lore.kernel.org/lkml/20210623083901.1d49d19d@canb.auug.org.au/
CC: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/struct-funcs.c