[pve-devel] [PATCH installer] sys: block: fix inverted check when detecting block size

Christoph Heiss c.heiss at proxmox.com
Thu Sep 21 13:22:56 CEST 2023


We do actually want the block size if it is integer - currently, it is
always set to `undef` (and then `null` in the serialized JSON).

Fixes: 15b2cd7 ("sys: block: fix possible use of `undef`-value when detecting disk sizes")
Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
 Proxmox/Sys/Block.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Proxmox/Sys/Block.pm b/Proxmox/Sys/Block.pm
index f76e0f1..7593495 100644
--- a/Proxmox/Sys/Block.pm
+++ b/Proxmox/Sys/Block.pm
@@ -104,7 +104,7 @@ my sub hd_list {
 
 	my $logical_bsize = file_read_firstline("$bd/queue/logical_block_size") // '';
 	chomp $logical_bsize;
-	if ($logical_bsize && $logical_bsize !~ m/^\d+$/) {
+	if ($logical_bsize && $logical_bsize =~ m/^\d+$/) {
 	    $logical_bsize = int($logical_bsize);
 	} else {
 	    $logical_bsize = undef;
-- 
2.41.0






More information about the pve-devel mailing list