tape: multi-volume: fix overflow check

the part number cannot go above 255 at the moment, but if it ever gets
bumped to a bigger integer type this boundary wouldn't cause a
compile-error. explicitly checking for overflowing u8 makes this a bit
more future-proof, and shuts up clippy as well ;)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2021-12-30 13:03:55 +01:00
parent 9a37bd6c84
commit 0a7f902e2a

View File

@ -69,7 +69,7 @@ impl <'a> TapeWrite for MultiVolumeWriter<'a> {
}
if self.writer.is_none() {
if self.header.part_number >= 255 {
if self.header.part_number == u8::MAX {
proxmox_sys::io_bail!("multi-volume writer: too many parts");
}
self.writer = Some(