From nobody Tue Nov 26 07:44:28 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1709681997; cv=none; d=zohomail.com; s=zohoarc; b=JDy4ikyxiOLAgblAumt96+5TNCWG972keWUuuu54n4Ce98aILV98cI4fuK2aUFlST2i+l/4HPWWKKH3wjIAtvOrzJfyoRj1SO1dWedYo9/jTOdA5eq6i7EDNOyCcPTFtXWUWZQ6d6KDXnUZCoagjtEj2rF5fEsyF+kO70sFfWSY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709681997; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=cNrt0Wl61cfd1qXgT4oVr/IuvLTx/2WAS0L17LlfJ9g=; b=LiiS9SUUj2zWLJdEkfzL6wSZ9sWUTdgp3DDSnW2p3OGGDTsK86CttgoHuDvAYRMZ9LHYUpgFLIHzJoV+LsUmnAHk1tJwcxGKgHtK1iszqSh+nIunizV8CxqBeRkP6Olb1KMV7bkzPy3rch0YpTVh0UKEIdmA8d8Qv7VC5I8EprU= 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 1709681997577219.26959190622722; Tue, 5 Mar 2024 15:39:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rheNr-0006lk-TM; Tue, 05 Mar 2024 18:39:44 -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 1rheNo-0006dZ-SG for qemu-devel@nongnu.org; Tue, 05 Mar 2024 18:39:41 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rheNn-0001W7-0y for qemu-devel@nongnu.org; Tue, 05 Mar 2024 18:39:40 -0500 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-29ae4c7da02so4105213a91.2 for ; Tue, 05 Mar 2024 15:39:36 -0800 (PST) Received: from stoup.. (098-147-055-211.res.spectrum.com. [98.147.55.211]) by smtp.gmail.com with ESMTPSA id s12-20020a17090ad48c00b0029aac9c523fsm10047291pju.47.2024.03.05.15.39.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 15:39:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709681975; x=1710286775; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=cNrt0Wl61cfd1qXgT4oVr/IuvLTx/2WAS0L17LlfJ9g=; b=LroM5vnFfZ1DiD6HMe0ijeveZZ6g9FJ5z6813QztpJm90HmkmKpMbzuS/zuaU7mUxY DMjxfLDLTP3fcvFLy6KoesPNuc7vPUm/4e2sQOP/eFyHcellJqAtOXPoGfPzUKzwib23 ycsowtsFxcJJebtVi+FzdZ7vwWoA8ZR0w9JkvAwOb7zv+dWLSs1Wm5T2DRnJvKdDr9h1 TR32rH9ukGQ+ahHagiXq2RG5cLqG8gAJdF4sjgtXPP/dxNcrUd6bEpG0WWZywRYGOYAN TVTa532mLICxabhFn2tCH5W1FawvKOgvsb5TI5vOlVfIPTmMHyQutcV9djT6z3D6VO8W 4NdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709681975; x=1710286775; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cNrt0Wl61cfd1qXgT4oVr/IuvLTx/2WAS0L17LlfJ9g=; b=iUd02nVnsaWIOTYB2KtSMvm8SYCrp1w7T2PANHwtaeahqkB7Mv2f0Ts7QQcCXS0ooi PvQrIAVR3qajUw5hasD2jbaupM66uqHOwf8sbvq21qqIWUsmf67gCzhv4z7qEWB2Syf9 zo1y/MoR/wiZq2iD0VQEUylgZ5YtESzvbMk0WrmlDOaUTvG9GdUQH+ywghL5IGLLskJk hVI0Wk4R+BAbgztWGjh0p20+sgqb/94wSzggiAHHXDPP3yG6vgZpeW7TvAD3xrlt3a7j TXN8SwGdBaGq8BDxHUor6IDQjMvfaJk5Gn+AfSnsKPL5quRPks8O+wbfws42689iV7Wb QyyA== X-Gm-Message-State: AOJu0YzTjf5oF/wrldTFNinLH5xp7quRySgVy9TAK+ZivQ1uogIthHVk rgfMD1p2TTwKdjl5desZM/gtu4OxhAPJuPRClJMHb6Jssp3w8aQTgLUtVMafNlq+7GpWdQ1tUDV 7 X-Google-Smtp-Source: AGHT+IGKBgZLbDHQf2z1qhqxo44HpmWlW9OkGpZ+Sm2wEcL6uXdJsasMDn5V/xrdjrhcCV5PVhw37Q== X-Received: by 2002:a17:90b:78a:b0:299:3efe:8209 with SMTP id l10-20020a17090b078a00b002993efe8209mr10122967pjz.4.1709681975546; Tue, 05 Mar 2024 15:39:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/2] linux-user/elfload: Don't close an unopened file descriptor Date: Tue, 5 Mar 2024 13:39:30 -1000 Message-Id: <20240305233931.283629-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240305233931.283629-1-richard.henderson@linaro.org> References: <20240305233931.283629-1-richard.henderson@linaro.org> MIME-Version: 1.0 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=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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, 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1709681998803100001 Content-Type: text/plain; charset="utf-8" Fixes Coverity CID: 1534964 Fixes: 106f8da664 ("linux-user/elfload: Open core file after vma_init") Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/elfload.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 0c299a7c15..8565b9520a 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -4522,7 +4522,9 @@ static int elf_core_dump(int signr, const CPUArchStat= e *env) ret =3D -errno; mmap_unlock(); cpu_list_unlock(); - close(fd); + if (fd >=3D 0) { + close(fd); + } return ret; } #endif /* USE_ELF_CORE_DUMP */ --=20 2.34.1