[pve-devel] Use of uninitialized value in multiplication (*) at /usr/share/perl5/PVE/API2/Qemu.pm line 769

Alexandre DERUMIER aderumier at odiso.com
Tue Jun 11 12:07:02 CEST 2013


Hi,
I just notice this on bandwith limit update

# qm set 115 -ide1 sheepdog:vm-115-disk-2,mbps_rd=9
update VM 115: -ide1 sheepdog:vm-115-disk-2,mbps_rd=9

# qm set 115 -ide1 sheepdog:vm-115-disk-2,mbps_rd=8
update VM 115: -ide1 sheepdog:vm-115-disk-2,mbps_rd=8
Use of uninitialized value in multiplication (*) at /usr/share/perl5/PVE/API2/Qemu.pm line 769.
Use of uninitialized value in multiplication (*) at /usr/share/perl5/PVE/API2/Qemu.pm line 769.


something is wrong with safe_num_ne, undef values should be 0


    if(&$safe_num_ne($drive->{mbps}, $old_drive->{mbps}) ||
               &$safe_num_ne($drive->{mbps_rd}, $old_drive->{mbps_rd}) ||
               &$safe_num_ne($drive->{mbps_wr}, $old_drive->{mbps_wr}) ||
               &$safe_num_ne($drive->{iops}, $old_drive->{iops}) ||
               &$safe_num_ne($drive->{iops_rd}, $old_drive->{iops_rd}) ||
               &$safe_num_ne($drive->{iops_wr}, $old_drive->{iops_wr})) {
               PVE::QemuServer::qemu_block_set_io_throttle($vmid,"drive-$opt", $drive->{mbps}*1024*1024,
                                                           $drive->{mbps_rd}*1024*1024, $drive->{mbps_wr}*1024*1024,
                                                           $drive->{iops}, $drive->{iops_rd}, $drive->{iops_wr})
                   if !PVE::QemuServer::drive_is_cdrom($drive);
          }


my $safe_num_ne = sub {
    my ($a, $b) = @_;

    return 0 if !defined($a) && !defined($b);
    return 1 if !defined($a);
    return 1 if !defined($b);

    return $a != $b;
};




I don't known how to fix it



More information about the pve-devel mailing list