> The array "base" which is passed to log_warnx might be uninitialized:
> virtio_get_base doesn't necessarily touch it if it returns -1. Maybe it
> would be better just omit base from the output, e.g.
> 
>       log_warnx("vm \"%s\" unable to read "
>           "base for disk %s", vcp->vcp_name,
>           vcp->vcp_disks[i]);

Here it is as a patch.

- James

diff --git a/usr.sbin/vmd/config.c b/usr.sbin/vmd/config.c
index 9ef5dca626e..3ce82052e4a 100644
--- a/usr.sbin/vmd/config.c
+++ b/usr.sbin/vmd/config.c
@@ -393,8 +393,8 @@ config_setvm(struct privsep *ps, struct vmd_vm *vm, 
uint32_t peerid, uid_t uid)
                                break;
                        if (n == -1) {
                                log_warnx("vm \"%s\" unable to read "
-                                   "base %s for disk %s", vcp->vcp_name,
-                                   base, vcp->vcp_disks[i]);
+                                   "base for disk %s", vcp->vcp_name,
+                                   vcp->vcp_disks[i]);
                                goto fail;
                        }
                        (void)strlcpy(path, base, sizeof(path));

Reply via email to