From nobody Sun May 5 08:09:07 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576074659; cv=none; d=zohomail.com; s=zohoarc; b=UUqko1es38XHYgkawIbFOnelzPttoEFiKvkcwN0tnFTfe6Ks4dvYGfsjPZRD65y5QRfrnEBlGLa76mtMeQ3fV4A1Ai5bAd37+VakCK4VzQdOUTRNSU22FpYT+K6KUEs/ERX55wUM+Z2tqXV0h2AJx8uOfbGEtTFq0HBFwxP3X1I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576074659; 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=SnbM4HZb29FsG4J6fiW5WwWfE0ShjwYvCK5bmD3CYRU=; b=WIODZd8O1OviJre96pS9LXL4vxh/lfaIyuGkKn73kk9lHOWRtlnXpEyowf2ETBmuiXuh4Qw+z+cDFFkm77GVVkGz9cukafa6OVnV43JPIh0PsVL7vKo5/o9Ax7smrUXSYS+feaIIW9UI3NdDw0lqZjBfB3tIEU3bv5sPZzMoIxY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576074659673996.1197220969515; Wed, 11 Dec 2019 06:30:59 -0800 (PST) Received: from localhost ([::1]:43242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1if30z-0004KK-U4 for importer@patchew.org; Wed, 11 Dec 2019 09:30:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33694) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1if2tv-0005Pm-CX for qemu-devel@nongnu.org; Wed, 11 Dec 2019 09:23:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1if2tt-0003D8-Tq for qemu-devel@nongnu.org; Wed, 11 Dec 2019 09:23:39 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:41492) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1if2tt-0003CA-Nw; Wed, 11 Dec 2019 09:23:37 -0500 Received: by mail-wr1-x443.google.com with SMTP id c9so24247094wrw.8; Wed, 11 Dec 2019 06:23:37 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id g23sm2503783wmk.14.2019.12.11.06.23.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Dec 2019 06:23:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SnbM4HZb29FsG4J6fiW5WwWfE0ShjwYvCK5bmD3CYRU=; b=ilpQS7Vg1VgZDqrE/uEczkUIFtJqrxecCgvPQcP2+fNZ5Y0wDu4jdpg7IfL4WqKzB4 w11BCNJ1sBFfapPPasdZzfqplIrJcK8lU3EDh+CSsEOp0m2BQIF+/EcocnNH9SZOFcbn u777YwftnULQEd18vrH5v34hGR16r+J8XZvylHWg0nC3gjuv12z1UVRGTaqokTR/4SeT EEmUTtG8q+GzxkR1ELvB1DhmVIaNFqA3+hxXGfdj3gQ39AlXjF1cBmrbVZ1YBtuRA8El WP3IDdnWkjbxuejYkljwSHjGhM42tHLpT1CDcB/76+Vdl2d1Bpnq6MENWIYGqQWh3Cbb oKCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=SnbM4HZb29FsG4J6fiW5WwWfE0ShjwYvCK5bmD3CYRU=; b=kHOP9PtpwAuv2Fqb37kttZzt4kFMKazhqyu+8AvwrmkCelj3J+D6WBFInUIU9SCvOO O/Oqu1G363dotmp/H6LYwRRtGzZ2WGF2FcvJRWHrDP0ys23tME7fBwgQ3abUr2GLF8Nu zJE2k5WXA0h6bhT6JJgHuNhhG7uHMua9/cDNifhTYT9vwe4Ce6GXkwmluBbyjpirIVcd FXHshE1sutVhKxd36bbj+GPor0aQcIwm7yNtrEYYpMje0WKLwDV1XZ2h/iJpToJ72FpA vNlrlt1zvq7DiRRAfWW0EjH7dnZDmww+Qs3olkRCLNFLzfHpVyslDXT5P3SwPawQbBKV AIVQ== X-Gm-Message-State: APjAAAUObBYvx5t8byiTHDud2aeoMnhBYzXV0SBFBSsEAj8xUuLkIjO4 CsL1z/9+QX/SUxppXZoBQs4H2Drm X-Google-Smtp-Source: APXvYqyezu+o4TaFOOsMQboqUbLhkRRiaWSUS1F+/DK+51nKA+uRVWg+uUeo2CzNKamq6QxK7V1x7Q== X-Received: by 2002:a05:6000:cb:: with SMTP id q11mr92237wrx.14.1576074216464; Wed, 11 Dec 2019 06:23:36 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH] monitor: fix maybe-uninitialized Date: Wed, 11 Dec 2019 15:23:26 +0100 Message-Id: <1576074210-52834-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau ../monitor/misc.c: In function =E2=80=98mon_get_cpu_sync=E2=80=99: /home/elmarco/src/qq/include/sysemu/hw_accel.h:22:9: error: =E2=80=98cpu=E2= =80=99 may be used uninitialized in this function [-Werror=3Dmaybe-uninitia= lized] 22 | kvm_cpu_synchronize_state(cpu); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../monitor/misc.c:397:15: note: =E2=80=98cpu=E2=80=99 was declared here 397 | CPUState *cpu; | ^~~ Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini Reviewed-by: Markus Armbruster --- monitor/misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monitor/misc.c b/monitor/misc.c index 3baa15f..a74cff3 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -394,7 +394,7 @@ int monitor_set_cpu(int cpu_index) /* Callers must hold BQL. */ static CPUState *mon_get_cpu_sync(bool synchronize) { - CPUState *cpu; + CPUState *cpu =3D NULL; =20 if (cur_mon->mon_cpu_path) { cpu =3D (CPUState *) object_resolve_path_type(cur_mon->mon_cpu_pat= h, @@ -411,6 +411,7 @@ static CPUState *mon_get_cpu_sync(bool synchronize) monitor_set_cpu(first_cpu->cpu_index); cpu =3D first_cpu; } + assert(cpu !=3D NULL); if (synchronize) { cpu_synchronize_state(cpu); } --=20 1.8.3.1