Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kDOfk-0003Id-ID for mharc-qemu-trivial@gnu.org; Wed, 02 Sep 2020 05:03:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDOfi-0003HN-L9; Wed, 02 Sep 2020 05:03:14 -0400 Received: from smtpout1.mo804.mail-out.ovh.net ([79.137.123.220]:56829) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDOfg-0000rv-QR; Wed, 02 Sep 2020 05:03:14 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.108.1.214]) by mo804.mail-out.ovh.net (Postfix) with ESMTPS id 3FFA15D15844; Wed, 2 Sep 2020 11:02:37 +0200 (CEST) Received: from kaod.org (37.59.142.99) by DAG8EX1.mxp5.local (172.16.2.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2044.4; Wed, 2 Sep 2020 11:02:36 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-99G003a7841263-e031-471e-97eb-1ff73c14c570, AA3809B24A0F88596FE87CA7447536A9393A4537) smtp.auth=groug@kaod.org Date: Wed, 2 Sep 2020 11:02:34 +0200 From: Greg Kurz To: Philippe =?UTF-8?B?TWF0aGlldS1EYXVkw6k=?= CC: , Laurent Vivier , Thomas Huth , Corey Minyard , "Michael S. Tsirkin" , , , "Paolo Bonzini" , David Gibson , Richard Henderson Subject: Re: [PATCH 4/5] tcg/tcg: Do not declare local variable only used for assertion Message-ID: <20200902110234.24c11cb2@bahia.lan> In-Reply-To: <20200902080801.160652-5-philmd@redhat.com> References: <20200902080801.160652-1-philmd@redhat.com> <20200902080801.160652-5-philmd@redhat.com> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.99] X-ClientProxiedBy: DAG9EX1.mxp5.local (172.16.2.81) To DAG8EX1.mxp5.local (172.16.2.71) X-Ovh-Tracer-GUID: 605fc3e3-31d9-46b8-b257-9c7f613ad740 X-Ovh-Tracer-Id: 6894166607698106869 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedrudefledgudduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepfffhvffukfgjfhfogggtgfhisehtqhertdertdejnecuhfhrohhmpefirhgvghcumfhurhiiuceoghhrohhugheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeevlefhtddufffhieevhefhleegleelgfetffetkedugeehjeffgfehhfefueduffenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddrleelnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpehgrhhouhhgsehkrghougdrohhrghdprhgtphhtthhopehrthhhsehtfihiuggulhgvrdhnvght Received-SPF: pass client-ip=79.137.123.220; envelope-from=groug@kaod.org; helo=smtpout1.mo804.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/02 04:59:26 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Sep 2020 09:03:15 -0000 On Wed, 2 Sep 2020 10:08:00 +0200 Philippe Mathieu-Daud=C3=A9 wrote: > This variable is used once in an assertion. Remove single > declaration and access directly in the assert(). >=20 > See in "qemu/osdep.h": >=20 > * [...] disable assertion is not > * supported upstream so the risk is all yours. Meanwhile, please > * submit patches to remove any side-effects inside an assertion, or > * fixing error handling that should use Error instead of assert. >=20 > Signed-off-by: Philippe Mathieu-Daud=C3=A9 > --- Ditto. > tcg/tcg.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) >=20 > diff --git a/tcg/tcg.c b/tcg/tcg.c > index 62f299e36e5..0bff49e544a 100644 > --- a/tcg/tcg.c > +++ b/tcg/tcg.c > @@ -777,7 +777,6 @@ void tcg_register_thread(void) > #else > void tcg_register_thread(void) > { > - MachineState *ms =3D MACHINE(qdev_get_machine()); > TCGContext *s =3D g_malloc(sizeof(*s)); > unsigned int i, n; > bool err; > @@ -795,7 +794,7 @@ void tcg_register_thread(void) > =20 > /* Claim an entry in tcg_ctxs */ > n =3D atomic_fetch_inc(&n_tcg_ctxs); > - g_assert(n < ms->smp.max_cpus); > + g_assert(n < MACHINE(qdev_get_machine())->smp.max_cpus); > atomic_set(&tcg_ctxs[n], s); > =20 > if (n > 0) {