From nobody Fri May 17 06:54:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604385347; cv=none; d=zohomail.com; s=zohoarc; b=n+Cn9RVWOdUH6sliajHI/L+7Ezh0iVaTbxvdktqrao3EFYuIs/lMRkJ09ISxRK0c5j6NNxX7X3LN4kD4onIFzBjYHHEAIkSX6K2n8KHKuR6k6wht248yaHTqY60R0Gh8W8j6YR3QzKUGCoWM9ZZ3br68dJe51n4qxqQGxMxW2mc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604385347; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=TzTQd6zsga848TZhSH4IIn0GT9mIurRHr8Lw0mt05Oc=; b=gSE3XB1s2l7WdeSC3IViLRgl55baXvDiYhFqDMiXydF9YVFnUoYWeTGLp2sDdO7kd3k1XHarA15P9yNDyXfWVMk1rbgJSUPlJyk6cWAPZsESQxi6/8DU22O3DIZ+8sA+nl0xGJSQXApvygwn2BQEy/XgxGs+01Ys80+UWyC6uNs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1604385347088365.2614221692079; Mon, 2 Nov 2020 22:35:47 -0800 (PST) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-40-Zem9-VF2N5KhkfKUsRgv-w-1; Tue, 03 Nov 2020 01:35:44 -0500 Received: by mail-wr1-f72.google.com with SMTP id 33so7365440wrf.22 for ; Mon, 02 Nov 2020 22:35:44 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id r1sm26295157wro.18.2020.11.02.22.35.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 22:35:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604385346; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TzTQd6zsga848TZhSH4IIn0GT9mIurRHr8Lw0mt05Oc=; b=UxP74ElYTp7OTyCgNtptSYOAnOyCuo2BYCuLRjDKIaHwhv2AAIZbUR8o5rzpLe3DDUS2hS 7tQeSA3HiYfG1ZK3ot4ZW7MQKjzlOKHfqm8pSLbhj6G/HlvVsQEtQ8vnHA+iSPhZsNeW4J nUhC/BCr2frBEanz4XSp/Dchvl+/vmM= X-MC-Unique: Zem9-VF2N5KhkfKUsRgv-w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TzTQd6zsga848TZhSH4IIn0GT9mIurRHr8Lw0mt05Oc=; b=XxQnjGc1AC7SNIoyHGULnqn3Ljz/F4Fk4ca4j2Gi6aMv86zztPzNPXAXOVg4rmQSe1 qQblt9ZCKRPHEvQrhxFVmsPLF1Uc3Ik1JF/GZkh7GvdpL7mvyNYUAYNEVwoYcYEKzCWe uNC5hQJoRSOAJsxbpNoZoovbL7Jlbivnb2J4t+UU9ZFjrhKIPoqd5vDGnVlXeBKu9fD6 TpsAjwMbKGFSoiBzzB2CGeVeaIw1OjoOr0K4OH8mzxhW4p62JWSv1s/uq7W1bCwIbzwL U45ts2gTpSNIe0dkzlrqFs4Ktf9GuV50HFOpBzGQ3QSk3D1Qac+mPgjTANBhIPs2ecI4 W4Cg== X-Gm-Message-State: AOAM530+Rkt+Rs1CdaLAScCOk5hUKxnZCTzfavQ6hhR81K19Mt+Qd9E9 XSX4WLSe3gpVGU8x3CrlDgY3gDtL/E/TO1HHStnzAFtweAaj9cIH0uwKQwoqpDUv7CsFfDQVjuG jbrFKS/s4FubpyQ== X-Received: by 2002:a05:600c:d5:: with SMTP id u21mr1866021wmm.28.1604385343106; Mon, 02 Nov 2020 22:35:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDxYt5GtMt+qrxaNt9L6v08RKe4SQ9boutdzJR3FLKPWpjQnafJ1rQNgYRZf6OOXGo9VeA1g== X-Received: by 2002:a05:600c:d5:: with SMTP id u21mr1866007wmm.28.1604385342949; Mon, 02 Nov 2020 22:35:42 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2] hw/virtio/vhost-backend: Fix Coverity CID 1432871 Date: Tue, 3 Nov 2020 07:35:41 +0100 Message-Id: <20201103063541.2463363-1-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Fix uninitialized value issues reported by Coverity: Field 'msg.reserved' is uninitialized when calling write(). While the 'struct vhost_msg' does not have a 'reserved' field, we still initialize it to have the two parts of the function consistent. Reported-by: Coverity (CID 1432864: UNINIT) Fixes: c471ad0e9bd ("vhost_net: device IOTLB support") Reviewed-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefano Garzarella --- v2: comment 'struct vhost_msg' is also initialized (Peter) --- hw/virtio/vhost-backend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c index 88c8ecc9e03..222bbcc62de 100644 --- a/hw/virtio/vhost-backend.c +++ b/hw/virtio/vhost-backend.c @@ -257,7 +257,7 @@ static int vhost_kernel_send_device_iotlb_msg(struct vh= ost_dev *dev, struct vhost_iotlb_msg *imsg) { if (dev->backend_cap & (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2)) { - struct vhost_msg_v2 msg; + struct vhost_msg_v2 msg =3D {}; =20 msg.type =3D VHOST_IOTLB_MSG_V2; msg.iotlb =3D *imsg; @@ -267,7 +267,7 @@ static int vhost_kernel_send_device_iotlb_msg(struct vh= ost_dev *dev, return -EFAULT; } } else { - struct vhost_msg msg; + struct vhost_msg msg =3D {}; =20 msg.type =3D VHOST_IOTLB_MSG; msg.iotlb =3D *imsg; --=20 2.26.2