zbd: Fix type of local variable min_bs
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Wed, 13 Oct 2021 06:09:00 +0000 (15:09 +0900)
committerJens Axboe <axboe@kernel.dk>
Sun, 17 Oct 2021 13:00:36 +0000 (07:00 -0600)
commit07fc3f57d106e58e0bcfff1a46ec8b4266770388
tree4f7c2f70334f6489ef3c2e2aa07a5e9d094cae2c
parentee5e3436012aad0d2a06c7638dad39f01ee44c1e
zbd: Fix type of local variable min_bs

In zbd.c, thread option min_bs[] is referred and stored in the local
variable min_bs. Elements of min_bs[] have type unsigned long long, but
the local variable min_bs has type uint32_t. When an element of min_bs[]
has value larger than UINT32_MAX, it overflows on assignment to min_bs.

To avoid the overflow, fix type of the local variable min_bs from
uint32_t to uint64_t. Use uint64_t rather than unsigned long long to be
more specific about data size and consistency in zbd.c. The variable is
passed to the helper function zbd_find_zone(), then fix the type of the
argument of the function also.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Link: https://lore.kernel.org/r/20211013060903.166543-3-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zbd.c