From patchwork Tue Nov 7 12:24:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13448571 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 6FD55C4332F for ; Tue, 7 Nov 2023 12:29:07 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0LB4-0001en-FN; Tue, 07 Nov 2023 07:27:31 -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 1r0LAH-0007aq-Nq for qemu-devel@nongnu.org; Tue, 07 Nov 2023 07:26:44 -0500 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0LA2-0005N7-A5 for qemu-devel@nongnu.org; Tue, 07 Nov 2023 07:26:39 -0500 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-53dfc28a2afso9445149a12.1 for ; Tue, 07 Nov 2023 04:26:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699359984; x=1699964784; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bPpjDkEUgqCeZLuJ7FjDj9Qp3yXD435hoj9y2GuMgcc=; b=V8aVhrGfgx39OX1v0S1sItKfH5CUDLVzn0sRdn0Le/D38biCGkycCpMb1mGGL5NEg/ 5hJy/iSYiZVA4VLXqUtwGxUn7QiWluaxymKt1UkSrKt5AC3ht1d+iz6wSBgNlW0OQn2v T61Sp+sDtY/GQqLY3PwS95Qhieh68QQPbNCocZbKr+amSADpd+dyFCaZFR5WdzDaoWNe t6EDSKLpLpEhZse9+vORYZUS4ee3/j9oRLszc9q9p9qxmB/a8aVi7Hqw3vQWOMDawGU9 IRXOHOuQiyv+iUxcmZxGe9VQtsxt2yJcH5rtVic11Wz5mFwge0euJwkExdS15oUG6l5W cu3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699359984; x=1699964784; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bPpjDkEUgqCeZLuJ7FjDj9Qp3yXD435hoj9y2GuMgcc=; b=q0XE8n5tLAhpt8e0Q8AWs1adNff8ZOMb+uHHWgIHrwikuW/VWahIF6rojcfj5/+GzG IlCmQOGGPsYh3NCZzCHHnxm5sr0jXIudaeTqB/nKTBO8lNHoRXj0TuAP1AFfMbclVMWD WX0f2VoeKPG7wR24iZprMeWGhuEUwyKZtTx1OiWb3nAhaJ29w2MnNSpUqaJszFPqTILk LcH/lxG1CSOIF8wRiYw0uFyFMn2ddu5B5jhmoc9zIOd0ptcxAoXzN9HN2LZKoux+KFNG NATIJ8S7jSR+lUmnM/G9ehcUIFe+q9Om3E0WRMwqqarByvwdNVIuFRwEu2Wjxv+gT6o4 qs0Q== X-Gm-Message-State: AOJu0YxLMLXqeudQz2coDRKPUGrCaiYccqXwfyydKOZ3KYcc68XmVaSR USaoZugxjbb4uIp8BcxyolnqU7iOjubVCTC+D6U= X-Google-Smtp-Source: AGHT+IHxpB6kgb0WTfTgGc+1bi7cqwZO6ngXV2cZun9HcsMF3ctSTQNPDcuJp0UjFYxIpufELGYkUg== X-Received: by 2002:a17:907:31c3:b0:9c7:db3:8b31 with SMTP id xf3-20020a17090731c300b009c70db38b31mr19724449ejb.59.1699359983864; Tue, 07 Nov 2023 04:26:23 -0800 (PST) Received: from m1x-phil.lan ([176.187.216.69]) by smtp.gmail.com with ESMTPSA id gz21-20020a170906f2d500b009ddcf5b07b8sm1002418ejb.148.2023.11.07.04.26.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 07 Nov 2023 04:26:23 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-block@nongnu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, Zongmin Zhou , Zongmin Zhou , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 75/75] dump: Add close fd on error return to avoid resource leak Date: Tue, 7 Nov 2023 13:24:41 +0100 Message-ID: <20231107122442.58674-17-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231107122442.58674-1-philmd@linaro.org> References: <20231107122442.58674-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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=unavailable 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 From: Zongmin Zhou Reported-by: Coverity CID 1523842 (RESOURCE_LEAK) Fixes: e6549197f7 ("dump: Add command interface for kdump-raw formats") Signed-off-by: Zongmin Zhou Reviewed-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231107024417.585475-1-min_halo@163.com> Signed-off-by: Philippe Mathieu-Daudé --- dump/dump.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dump/dump.c b/dump/dump.c index 1c304cadfd..ad5294e853 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -2160,6 +2160,7 @@ void qmp_dump_guest_memory(bool paging, const char *protocol, return; } if (kdump_raw && lseek(fd, 0, SEEK_CUR) == (off_t) -1) { + close(fd); error_setg(errp, "kdump-raw formats require a seekable file"); return; }