From: dv Date: Sun, 4 Feb 2024 14:54:51 +0000 (+0000) Subject: Initialize result in vioblk notification handler. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f0a117866823fa4f5bc035e8451e8b20187ec6cd;p=openbsd Initialize result in vioblk notification handler. In the event the driver kicks the vioblk device, but the guest doesn't have any available virtqueue space, vmd will return an uninitialized value. If non-zero, it results in a notification to the driver and effectively a spurious interrupt. Found by smatch, reported by and ok jsg@ --- diff --git a/usr.sbin/vmd/vioblk.c b/usr.sbin/vmd/vioblk.c index 427fdea43c1..b1d393f8a8a 100644 --- a/usr.sbin/vmd/vioblk.c +++ b/usr.sbin/vmd/vioblk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioblk.c,v 1.10 2024/02/03 00:28:07 jsg Exp $ */ +/* $OpenBSD: vioblk.c,v 1.11 2024/02/04 14:54:51 dv Exp $ */ /* * Copyright (c) 2023 Dave Voutila @@ -301,7 +301,7 @@ vioblk_notifyq(struct vioblk_dev *dev) uint8_t ds; off_t offset; ssize_t sz; - int is_write, notify, i; + int is_write, notify = 0, i; char *vr; struct vring_desc *table, *desc; struct vring_avail *avail;