btrfs: fix int32 overflow in shrink_delalloc().
authorAdam Borowski <kilobyte@angband.pl>
Sun, 8 May 2016 13:08:00 +0000 (15:08 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 9 May 2016 09:51:19 +0000 (11:51 +0200)
commit8eb0dfdbda3f56bf7d248ed87fcc383df114ecbb
tree94790c517b62412cf192002fbf2a454db3742472
parent2f3165ecf103599f82bf0ea254039db335fb5005
btrfs: fix int32 overflow in shrink_delalloc().

UBSAN: Undefined behaviour in fs/btrfs/extent-tree.c:4623:21
signed integer overflow:
10808 * 262144 cannot be represented in type 'int [8]'

If 8192<=items<16384, we request a writeback of an insane number of pages
which is benign (everything will be written).  But if items>=16384, the
space reservation won't be enough.

Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c