]> xenbits.xensource.com Git - libvirt.git/commitdiff
viriscsi: Request more random bits for interface name
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 1 Aug 2018 11:35:51 +0000 (13:35 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 1 Aug 2018 13:07:40 +0000 (15:07 +0200)
In virStorageBackendCreateIfaceIQN() the virRandomBits() is
called in order to use random bits to generate random name for
new interface. However, virAsprintf() is expecting 32 bits and we
are requesting only 30.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Pino Toscano <ptoscano@redhat.com>
src/util/viriscsi.c

index 653b4fd93291ecabc2b130a3b621c551dab4ae89..f00aeb53a76765a4b32f173a97a351853e8d497f 100644 (file)
@@ -221,7 +221,7 @@ virStorageBackendCreateIfaceIQN(const char *initiatoriqn,
 
     if (virAsprintf(&temp_ifacename,
                     "libvirt-iface-%08llx",
-                    (unsigned long long)virRandomBits(30)) < 0)
+                    (unsigned long long)virRandomBits(32)) < 0)
         return -1;
 
     VIR_DEBUG("Attempting to create interface '%s' with IQN '%s'",