brd: normalize non-positive max_part before rounding it up#945
brd: normalize non-positive max_part before rounding it up#945blktests-ci[bot] wants to merge 1 commit into
Conversation
|
Upstream branch: 979c294 |
a7bb5c5 to
5e41a3b
Compare
|
Upstream branch: acb7500 |
e294502 to
cf302b5
Compare
5e41a3b to
c3a084b
Compare
|
Upstream branch: 9716c08 |
cf302b5 to
414dc80
Compare
c3a084b to
5f78e5d
Compare
|
Upstream branch: 2a2974b |
414dc80 to
9ecf8c6
Compare
5f78e5d to
e48f9db
Compare
|
Upstream branch: 062871f |
9ecf8c6 to
407a53b
Compare
199644a to
e6d9eb8
Compare
|
Upstream branch: 66affa3 |
407a53b to
0234d6a
Compare
e6d9eb8 to
7d8604f
Compare
|
Upstream branch: bade58e |
0234d6a to
0c0eb85
Compare
7d8604f to
4cc45a3
Compare
|
Upstream branch: 4edcdef |
0c0eb85 to
e8bd33b
Compare
4cc45a3 to
90ffd56
Compare
`max_part` is an `int` module parameter, but brd only resets zero before rounding non-divisor values with `1UL << fls(max_part)`. A negative value such as -1 passes the initial zero check. The modulo test then reaches the roundup, where `fls(-1)` yields 32. On 64-bit builds that produces 4294967296, which is then assigned back to `int max_part` as zero. `brd_alloc()` passes that zero value to `disk->minors`, and block core warns and rejects the disk. Normalize non-positive values to the existing one-partition fallback before the modulo/roundup, and apply the existing `DISK_MAX_PARTS` clamp before the roundup so it only operates on representable, in-range values. Assisted-by: Codex:gpt-5.5-cyber-preview Signed-off-by: Samuel Moelius <sam.moelius@trailofbits.com>
|
Upstream branch: dc59e4f |
e8bd33b to
7f3e325
Compare
Pull request for series with
subject: brd: normalize non-positive max_part before rounding it up
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1108157