]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
badblocks: fix mis-printed error from block size check
authorCorey Hickey <bugfood-c@fatooh.org>
Mon, 24 Jan 2022 01:39:33 +0000 (17:39 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 1 Feb 2023 16:37:18 +0000 (11:37 -0500)
commit513e559bfccc1a909900a47841a4367bdfff1470
treeea7b2cad800b5bfa5534b1a1ab47dfb6e08b8b32
parent5c04fdf8ce4dfc35cd36084d7feeca1a11dfedab
badblocks: fix mis-printed error from block size check

block_size is parsed as an unsigned int from parse_uint(), so retain it
as such until _after_ it has been constrained to a size within INT_MAX.

Lower level code still requires this to be an int, so cast to int for
anything below main().

Before:
$ misc/badblocks -w -b 4294967295 -c 1 /tmp/testfile.bin
misc/badblocks: Invalid block size: -1

After:
$ misc/badblocks -w -b 4294967295 -c 1 /tmp/testfile.bin
misc/badblocks: Invalid block size: 4294967295

Signed-off-by: Corey Hickey <bugfood-c@fatooh.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/badblocks.c