From patchwork Tue Dec 19 18:22:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Tardieu X-Patchwork-Id: 13498842 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E8352C41535 for ; Tue, 19 Dec 2023 18:23:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rFejZ-0001pi-7E; Tue, 19 Dec 2023 13:22:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rFejX-0001pI-Ur for qemu-devel@nongnu.org; Tue, 19 Dec 2023 13:22:23 -0500 Received: from zoidberg.rfc1149.net ([195.154.227.159]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rFejW-0001Al-4b for qemu-devel@nongnu.org; Tue, 19 Dec 2023 13:22:23 -0500 Received: from buffy.. (buffy [192.168.147.6]) by zoidberg.rfc1149.net (Postfix) with ESMTP id CEAE380024; Tue, 19 Dec 2023 19:22:18 +0100 (CET) Authentication-Results: zoidberg.rfc1149.net; dmarc=fail (p=none dis=none) header.from=rfc1149.net Authentication-Results: zoidberg.rfc1149.net; spf=fail smtp.mailfrom=rfc1149.net From: Samuel Tardieu To: qemu-devel@nongnu.org Cc: Richard Henderson , Samuel Tardieu Subject: [PATCH v2 0/2] tcg: Jump after always false condition Date: Tue, 19 Dec 2023 19:22:10 +0100 Message-ID: <20231219182212.455952-1-sam@rfc1149.net> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Received-SPF: pass client-ip=195.154.227.159; envelope-from=sam@rfc1149.net; helo=zoidberg.rfc1149.net 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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Unreachable code in an error handling block is listed in issue https://gitlab.com/qemu-project/qemu/-/issues/2030. After removing this code, the `fail` label is now immediately followed by a test whose condition can never be true when coming explicitly via this label. Moving the label down preserves the fall-through case while avoiding testing an always false condition. Changes from v1: - Add a comment explaining that `buf_rx` does not require cleanup - Use a unique cleanup path for the function by setting `errno` before jumping to the cleanup block. Samuel Tardieu (2): tcg: Remove unreachable code tcg: Make the cleanup-on-error path unique tcg/region.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) Reviewed-by: Peter Maydell