From nobody Fri May 17 01:10:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1662822826; cv=none; d=zohomail.com; s=zohoarc; b=dRUgs2VtQIYfLS0kQlmSpZ16X3aCQiinx4izdDRf/izvpxXnCrUXl1QWJULmepFd4cAGHlkmlldP7oIdsf4LkBUqd62kzYZXBjQ6f2XWWertZkjXno/GXKENXPkZ/JD2qc/LndiWdG7WMAqb4z5YnkuJzzc5aYYz6vHqcq9Qqe8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662822826; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=I+GXoMtsvnMhLgL7ULYr+soHxCdrKX4pcoCICaaAZxY=; b=JC8+VsS7XyYvqjdmYa02DLg+wwHy/j3FJh7PxkUrAzeokOAysZQ1oNIyHFK/OAnqK/Cl//LGI7kSowi9jMYiWkYubMLWilF9B0hIS0jxH6dRBC4jM4tXsRs/vuYRENNeYCzT3TXa94h7loTxGAD1cpEMU0iY+GXcQQ9FoUmyLaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662822826549287.64686199691846; Sat, 10 Sep 2022 08:13:46 -0700 (PDT) Received: from localhost ([::1]:41988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oX2Ay-0002sZ-Ll for importer@patchew.org; Sat, 10 Sep 2022 11:13:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oX29I-0001S4-LC; Sat, 10 Sep 2022 11:12:02 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]:43582) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oX29F-00047B-30; Sat, 10 Sep 2022 11:11:59 -0400 Received: by mail-ej1-x62d.google.com with SMTP id v16so10563634ejr.10; Sat, 10 Sep 2022 08:11:55 -0700 (PDT) Received: from localhost.localdomain (dynamic-089-012-029-149.89.12.pool.telefonica.de. [89.12.29.149]) by smtp.gmail.com with ESMTPSA id o15-20020a170906768f00b0077826b92d99sm1858968ejm.12.2022.09.10.08.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Sep 2022 08:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=I+GXoMtsvnMhLgL7ULYr+soHxCdrKX4pcoCICaaAZxY=; b=fu1qhQkwUVq2N2o+Q8XHgxd349FeNdrrRJvG83oLq5mFBkWKp/FiVa0ho14lN3Emfx JhUKGZZP7doEZutFppP19QP6+VGZMbEvJpuu89xD+h0WQQyhRB1rUGvYhljfBVajDkwK rCdxu+X/cE7ld1R6SfKxeW6WdnQNJM41OCyrnwi+L8YpP7PvoTG4iQmZAeqiTBPkEcfU VZ7pWse460l2aasaNu0sksI7iuhNMzU8oPwBYDDWQ1jUN7iZUSy8DkkPutHRm763QA44 F0u5bcYVwsGSUYTMwtZ/WlD62u7nGSZmb9BMgSoxqeraJodvfm4++8XdWwR7VSrYrGnt yyQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=I+GXoMtsvnMhLgL7ULYr+soHxCdrKX4pcoCICaaAZxY=; b=W84t1FicMpij5UuNQnB5qJkOsshwoGknK7qU/QRXN7YM+6GZ7TbT11h3hPpw0Y6iUu Ha9GqptjsBpCxDNjhm7SySBko8iEqySqukcJJIhx1JQEerqTWaGxzswuujbBlHoFwvGe t80dB2yJTihd7FourAPMrckvdmzvZDbCbCfHiVtAj30zbgyIdHM1pFAvp9W2V7QQWyIE G5jE0abcMSs5TSQjuTHLEduLG294NXQv0zgtxKugduVnRDIJxpd2a2lkTY4s+P5XtGw0 05TnJflPy4L1Nsb0m1XKX0CC9rHsRfKHCZns9LNkxMX4Qce3uH7wtd9kEbenVw/njHTe qcDw== X-Gm-Message-State: ACgBeo11deZVIE9DBFbw1gyRHpgxrDUXNzuu49vUFmKk37rPcQvYiNyK 3Q7NOC2yGHwVzuy4q8MALm7PU6sxcDk= X-Google-Smtp-Source: AA6agR4p5d8qs+4UEBqPFApBAZh+Zc0TzC+izCinlGXFWzzy41u0GGZiNa/TPa2waZSQqTBlLxPHOg== X-Received: by 2002:a17:907:2d23:b0:730:acf0:4907 with SMTP id gs35-20020a1709072d2300b00730acf04907mr13508906ejc.700.1662822713807; Sat, 10 Sep 2022 08:11:53 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, "Michael S. Tsirkin" , Bernhard Beschow Subject: [PATCH v2] hw/virtio/vhost-shadow-virtqueue: Silence GCC error "maybe-uninitialized" Date: Sat, 10 Sep 2022 17:11:17 +0200 Message-Id: <20220910151117.6665-1-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=shentey@gmail.com; helo=mail-ej1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1662822828802100001 GCC issues a false positive warning, resulting in build failure with -Werro= r: In file included from /usr/include/glib-2.0/glib.h:114, from src/include/glib-compat.h:32, from src/include/qemu/osdep.h:144, from ../src/hw/virtio/vhost-shadow-virtqueue.c:10: In function =E2=80=98g_autoptr_cleanup_generic_gfree=E2=80=99, inlined from =E2=80=98vhost_handle_guest_kick=E2=80=99 at ../src/hw/v= irtio/vhost-shadow-virtqueue.c:292:42: /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: =E2=80=98elem= =E2=80=99 may be used uninitialized [-Werror=3Dmaybe-uninitialized] 28 | g_free (*pp); | ^~~~~~~~~~~~ ../src/hw/virtio/vhost-shadow-virtqueue.c: In function =E2=80=98vhost_han= dle_guest_kick=E2=80=99: ../src/hw/virtio/vhost-shadow-virtqueue.c:292:42: note: =E2=80=98elem=E2= =80=99 was declared here 292 | g_autofree VirtQueueElement *elem; | ^~~~ cc1: all warnings being treated as errors There is actually no problem since "elem" is initialized in both branches. Silence the warning by initializig it with "NULL". $ gcc --version gcc (GCC) 12.2.0 Fixes: 9c2ab2f1ec333be8614cc12272d4b91960704dbe ("vhost: stop transfer elem= ownership in vhost_handle_guest_kick") Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/virtio/vhost-shadow-virtqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-vi= rtqueue.c index e8e5bbc368..596d4434d2 100644 --- a/hw/virtio/vhost-shadow-virtqueue.c +++ b/hw/virtio/vhost-shadow-virtqueue.c @@ -289,7 +289,7 @@ static void vhost_handle_guest_kick(VhostShadowVirtqueu= e *svq) virtio_queue_set_notification(svq->vq, false); =20 while (true) { - g_autofree VirtQueueElement *elem; + g_autofree VirtQueueElement *elem =3D NULL; int r; =20 if (svq->next_guest_avail_elem) { --=20 2.37.3