From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1rfOtC-0003f8-LJ for mharc-qemu-trivial@gnu.org; Wed, 28 Feb 2024 13:42:46 -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 1rfOtB-0003eY-83 for qemu-trivial@nongnu.org; Wed, 28 Feb 2024 13:42:45 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rfOt9-0003dJ-QJ for qemu-trivial@nongnu.org; Wed, 28 Feb 2024 13:42:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709145763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YhrqX7psku9eSHrEeMEdRERJSXqzbaTU3tVB6hTVYOM=; b=Fd3Gtx9+u+fqLYVZhKP9SYnRhXvmmJe8GhWWWFQ6nfbzYjJIImYOOybRUUK65q72/RJPOF xwkW7vLqwYhruYKPL04B9erkZsgiogZniLXaeJfkyre9M2cXJe5UCzqYEC+2L4vdK8FSAd SFI+tCmdCsrsCX93QBK71AJoqpNZ+V0= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-562-oxZztMv2OjGC4FznD0upxA-1; Wed, 28 Feb 2024 13:42:39 -0500 X-MC-Unique: oxZztMv2OjGC4FznD0upxA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B1B49380670E; Wed, 28 Feb 2024 18:42:38 +0000 (UTC) Received: from localhost (unknown [10.39.192.165]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C095A20; Wed, 28 Feb 2024 18:42:38 +0000 (UTC) Date: Wed, 28 Feb 2024 13:42:36 -0500 From: Stefan Hajnoczi To: Zhao Liu Cc: Markus Armbruster , Michael Roth , Michael Tokarev , Philippe =?iso-8859-1?Q?Mathieu-Daud=E9?= , qemu-devel@nongnu.org, qemu-trivial@nongnu.org, Zhao Liu , Kevin Wolf , Hanna Reitz Subject: Re: [PATCH 09/16] block/qed: Fix missing ERRP_GUARD() for error_prepend() Message-ID: <20240228184236.GC641417@fedora> References: <20240228163723.1775791-1-zhao1.liu@linux.intel.com> <20240228163723.1775791-10-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8omULJJLgKe+ToR0" Content-Disposition: inline In-Reply-To: <20240228163723.1775791-10-zhao1.liu@linux.intel.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.102, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-trivial@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Feb 2024 18:42:45 -0000 --8omULJJLgKe+ToR0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 29, 2024 at 12:37:16AM +0800, Zhao Liu wrote: > From: Zhao Liu >=20 > As the comment in qapi/error, passing @errp to error_prepend() requires > ERRP_GUARD(): >=20 > * =3D Why, when and how to use ERRP_GUARD() =3D > * > * 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. >=20 > ERRP_GUARD() could avoid the case when @errp is the pointer of > error_fatal, the user can't see this additional information, because > exit() happens in error_setg earlier than information is added [1]. >=20 > The bdrv_qed_co_invalidate_cache() passes @errp to error_prepend() > without ERRP_GUARD(). >=20 > Though it is a BlockDriver.bdrv_co_invalidate_cache() method, and > currently its @errp parameter only points to callers' local_err, to > follow the requirement of @errp, add missing ERRP_GUARD() at the > beginning of this function. >=20 > [1]: Issue description in the commit message of commit ae7c80a7bd73 > ("error: New macro ERRP_GUARD()"). >=20 > Cc: Stefan Hajnoczi > Cc: Kevin Wolf > Cc: Hanna Reitz > Signed-off-by: Zhao Liu > --- > block/qed.c | 1 + > 1 file changed, 1 insertion(+) Reviewed-by: Stefan Hajnoczi --8omULJJLgKe+ToR0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmXffpwACgkQnKSrs4Gr c8jFZgf8C0jop7R9vrqAsAAX1WKn663UR+MDD6oOr6YZru4e2cn3sFI2dyMAbuqo QEGZ9Zon7OgcwsEPs6CB0LFRQp+PRLz6rC+Dya1zHs7JKVpt07NldCB6Ru+TcUU3 u6wJsPHVjv6fNsaw6jNRAw3js/rjb0N5mmxdGW6x8x50WAtkL+VFbklZrnL9S3dF 5/dOwhbiLz8apFQlgjIc9AvuVVYAbFKaalQ7vAFYMiiKB+bLnE9jiCuaSyFDAOfj d+qVT+Z4fVwxP2907tzdyNuOWvzo7R1owxEoRSkAkF8jhe7T6rzTlaOrsuLNysLc 5awN9LCp3jBVi2cH7lcBpA+sVjbegw== =NW/o -----END PGP SIGNATURE----- --8omULJJLgKe+ToR0--