Commit 5f3bd90
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>1 parent 382497a commit 5f3bd90
1 file changed
+6
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1085 | 1085 | | |
1086 | 1086 | | |
1087 | 1087 | | |
1088 | | - | |
1089 | | - | |
1090 | | - | |
1091 | | - | |
1092 | | - | |
| 1088 | + | |
1093 | 1089 | | |
1094 | 1090 | | |
1095 | | - | |
1096 | | - | |
| 1091 | + | |
| 1092 | + | |
1097 | 1093 | | |
1098 | | - | |
1099 | | - | |
1100 | | - | |
| 1094 | + | |
| 1095 | + | |
1101 | 1096 | | |
1102 | 1097 | | |
1103 | 1098 | | |
1104 | 1099 | | |
1105 | 1100 | | |
1106 | 1101 | | |
1107 | | - | |
| 1102 | + | |
1108 | 1103 | | |
1109 | 1104 | | |
1110 | 1105 | | |
| |||
0 commit comments