From patchwork Tue Mar 12 08:22:29 2024 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: 779687 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1907198wrt; Tue, 12 Mar 2024 01:24:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWMbbgElWz8SySLcuzgS+3bbLpHkIxA7s/2HMLGR9llgC+YLj71uXe10dZXZENDqsj7SnKBtHKYhh+RXXz2Kw5C X-Google-Smtp-Source: AGHT+IF1LqPVbwUilJDJC2QEK7WPhPb6jImpoiTbjT13nQTzJkExRYopeMMpfKxhkmLtlxHwbnAE X-Received: by 2002:ac8:5a56:0:b0:42e:b2e9:36eb with SMTP id o22-20020ac85a56000000b0042eb2e936ebmr1364391qta.28.1710231883051; Tue, 12 Mar 2024 01:24:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710231883; cv=none; d=google.com; s=arc-20160816; b=zv2GzMevl79RCoyaLp5dXca7wW0APiJgWx3aJQ1tWIrvHYttsVbsIVGajEByEAQ906 CTZI+kFmMSX2hrYNUqon9bM5jRNIfVd6liSHi1gCliYD0n1frBiM9p2Sv5zF6z0xRNsu On1kbtux9j5srZlC5VY14bDNx0EoIhH+HKJF1H4jCs8F6P7c6mrEbFvsbY2dnhxBFo+g 5Qfxysss3/75PrpzlXEraDxDx+caXcnI6y5yKHAWfovtrDTpX653oqV8QUsCTW/paAhU AKekAS220ZwVelJYNskB9GsHSQkKgrTxmglRjFC6mKJld5D+j42L4Jqrfz1/gm2agFs6 apWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3FG8zZPJK1bf6KOQDF42ZpXKRx0qaQ0s6JgBLKqquGU=; fh=vEmE4oYPjq0Kq96ZSCF5EjpQJOmKbFMIRTpeGjgHc0I=; b=D8ceIq31Gug5y5u642MvTmCZPDR5zHRci9KjMnxpvK+c0pNDuiWGZmU5TFztgwu7LB KCX/UVCP2N4jlkApGBEqgVyOg6qrLCheMDFBu4315IpaBxnkqglX1ELwHhP9wUo/5rWh h9fFUyQLuazypW7fgp4YnnlQfDBMLI1tc4m9Ezyj2JM7XRcSaUClgdNnI9yGf3MIO21c jmFTYLuQ2C+epp4QRmFTEVBApo3MMsU0n44rT+7mID7Fqsa4vXFNDZ2w1Kz5jpotXO2l cvOOe637470GVGBSCAo9mZsNuLdfuBw/V/WsFtoyXLfXetJ22FpaT2wlKDWn5lZt5UfD oDPQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A1j1qLwu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w11-20020ac87e8b000000b0042efb9e64dbsi7079770qtj.222.2024.03.12.01.24.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 01:24:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A1j1qLwu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjxPm-0005l1-Uy; Tue, 12 Mar 2024 04:23:14 -0400 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 1rjxPk-0005jl-Pv for qemu-devel@nongnu.org; Tue, 12 Mar 2024 04:23:12 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjxPi-00019f-1U for qemu-devel@nongnu.org; Tue, 12 Mar 2024 04:23:12 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4131b1f8c91so25234835e9.3 for ; Tue, 12 Mar 2024 01:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710231788; x=1710836588; 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=3FG8zZPJK1bf6KOQDF42ZpXKRx0qaQ0s6JgBLKqquGU=; b=A1j1qLwuGMRGbtGfo7okEOBKDikyI0zeXLTiJTSJXo2ywBZt7setZb5E4Ugpjg9kd+ u+cR6Q+oF78noG0Ed6WBQAT69FWkNPfKBFnIy1yrlfJ4WUfDGhfaLOA39xNNhxCQEG7w RjXAWUeC+XQL1/to/OQ9Hp3xhpyBlNvMmPQCqNUw5hmrN8oOuhSdpDCay7gz+Ep8JsOO 4PvviiFS3EesELq474IqOkclVZ/JAt+PBd/fq3i2hbw7aWieH0mPg/ezhCVtnWRkB9DP ZgdN5stDM3VOGphko+5dF48wg2Cd6pfX11y4tsd3CkRAiuMi7HpVUoww3RxSjbWealXz 1/rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710231788; x=1710836588; 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=3FG8zZPJK1bf6KOQDF42ZpXKRx0qaQ0s6JgBLKqquGU=; b=Xa18ty/nSOhEDddG6LB9R1zArU+4+XwxaBnppwkMonxutrMQE7bEdrdLcNOH6wtlW8 pbBbKY4C27DE1jaQTxzJLVeo6t78Ae4BzMwq2YcqTkDoH6VjnJG8jj7Y1Vh9yYP3R33R hLvp0i6bC8/Rafl3/XDIsPY3VCJPQ4ejq2nmhX6LD3zIzP2yBHan1CGOykWinFfL7aLi rSoUESDF4DQ31MT7OMQ2quYS7/6kGhAqHR8cxxK0Y788LiPbfzpAwc756rgq8EsHBljG /GTjWhWZsRXc2/yT73m8MMugQHxsk0ZwW8sEnw2hpFp9jiYoz9WFHucqD/tPYOJXzSwz nDmA== X-Gm-Message-State: AOJu0Yy4U5K49I+vZaVn4DxcmxsRp92ctI090k4XoTsbnY0pMshccfCl opsAa0ec17RWI9WGefeZKV64/vdgeYBTD4pLrd4iTXY49Js/RH10CQ7aDEVVr90E+aF+yzL0rMF f X-Received: by 2002:a05:600c:3513:b0:413:1741:289f with SMTP id h19-20020a05600c351300b004131741289fmr7491099wmq.5.1710231787739; Tue, 12 Mar 2024 01:23:07 -0700 (PDT) Received: from m1x-phil.lan ([176.187.206.139]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm16112266wmo.0.2024.03.12.01.23.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Mar 2024 01:23:07 -0700 (PDT) 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, Zhao Liu , Paul Burton , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 04/13] hw/core/loader-fit: Fix missing ERRP_GUARD() for error_prepend() Date: Tue, 12 Mar 2024 09:22:29 +0100 Message-ID: <20240312082239.69696-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240312082239.69696-1-philmd@linaro.org> References: <20240312082239.69696-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Zhao Liu As the comment in qapi/error, passing @errp to error_prepend() requires ERRP_GUARD(): * = Why, when and how to use ERRP_GUARD() = * * Without ERRP_GUARD(), use of the @errp parameter is restricted: ... * - It should not be passed to error_prepend(), error_vprepend() or * error_append_hint(), because that doesn't work with &error_fatal. * ERRP_GUARD() lifts these restrictions. * * To use ERRP_GUARD(), add it right at the beginning of the function. * @errp can then be used without worrying about the argument being * NULL or &error_fatal. ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user can't see this additional information, because exit() happens in error_setg earlier than information is added [1]. In hw/core/loader-fit.c, there are 2 functions passing @errp to error_prepend() without ERRP_GUARD(): - fit_load_kernel() - fit_load_fdt() Their @errp parameters are both the pointers of the local @err virable in load_fit(). Though they don't cause the issue like [1] said, to follow the requirement of @errp, add missing ERRP_GUARD() at their beginning. [1]: Issue description in the commit message of commit ae7c80a7bd73 ("error: New macro ERRP_GUARD()"). Cc: Paul Burton Cc: Aleksandar Rikalo Signed-off-by: Zhao Liu Message-ID: <20240311033822.3142585-15-zhao1.liu@linux.intel.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/core/loader-fit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/core/loader-fit.c b/hw/core/loader-fit.c index b7c7b3ba94..9f20007dbb 100644 --- a/hw/core/loader-fit.c +++ b/hw/core/loader-fit.c @@ -120,6 +120,7 @@ static int fit_load_kernel(const struct fit_loader *ldr, const void *itb, int cfg, void *opaque, hwaddr *pend, Error **errp) { + ERRP_GUARD(); const char *name; const void *data; const void *load_data; @@ -178,6 +179,7 @@ static int fit_load_fdt(const struct fit_loader *ldr, const void *itb, int cfg, void *opaque, const void *match_data, hwaddr kernel_end, Error **errp) { + ERRP_GUARD(); Error *err = NULL; const char *name; const void *data;