From 0a7f902e2ac66529e646495606207c4d9efaf9a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Thu, 30 Dec 2021 13:03:55 +0100 Subject: [PATCH] tape: multi-volume: fix overflow check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/tape/file_formats/multi_volume_writer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tape/file_formats/multi_volume_writer.rs b/src/tape/file_formats/multi_volume_writer.rs index 8d51969e..d1b2c70b 100644 --- a/src/tape/file_formats/multi_volume_writer.rs +++ b/src/tape/file_formats/multi_volume_writer.rs @@ -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(