diff options
author | 2023-11-09 21:06:04 +0000 | |
---|---|---|
committer | 2023-12-29 11:58:22 -0800 | |
commit | 5f3bd90d9b98855c2e811aa3b4823d583b0020df (patch) | |
tree | 9273918c69f3432602cd2cbccd2a27ca0583ed32 /mm/rmap.c | |
parent | buffer: calculate block number inside folio_init_buffers() (diff) | |
download | wireguard-linux-5f3bd90d9b98855c2e811aa3b4823d583b0020df.tar.xz wireguard-linux-5f3bd90d9b98855c2e811aa3b4823d583b0020df.zip |
buffer: fix grow_buffers() for block size > PAGE_SIZE
We must not shift by a negative number so work in terms of a byte offset
to avoid the awkward shift left-or-right-depending-on-sign option. This
means we need to use check_mul_overflow() to ensure that a large block
number does not result in a wrap.
Link: https://lkml.kernel.org/r/20231109210608.2252323-4-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Pankaj Raghav <p.raghav@samsung.com>
Cc: Ryusuke Konishi <konishi.ryusuke@gmail.com>
[nathan@kernel.org: add cast in grow_buffers() to avoid a multiplication libcall]
Link: https://lkml.kernel.org/r/20231128-avoid-muloti4-grow_buffers-v1-1-bc3d0f0ec483@kernel.org
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/rmap.c')
0 files changed, 0 insertions, 0 deletions