From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1rfha6-0000Za-9d for mharc-qemu-trivial@gnu.org; Thu, 29 Feb 2024 09:40:19 -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 1rfha3-0000Yk-Nd; Thu, 29 Feb 2024 09:40:17 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfha1-0000pq-WA; Thu, 29 Feb 2024 09:40:15 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 777B8228C1; Thu, 29 Feb 2024 14:40:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709217611; h=from:from:reply-to: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=hNpKbYqfzuf/MaKse8ndi5jx0DwmYBrPj+7dmmZyC8I=; b=0Y/aHk0tn25s0ubDCmfPYdzBpK9sCDYoER3nisWjO+b5Gy43qKtzLhYC6YFBaChyHjFN0K yXfH3RPrSqIm7ffpYccZfIFRS4ej1H7GI22FgszE4FMUT/njxfCgeU1/YaC6sYUyaa1qR7 XJa987R1tPwdx2O5cxIoMHnhR2zM2Hg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709217611; h=from:from:reply-to: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=hNpKbYqfzuf/MaKse8ndi5jx0DwmYBrPj+7dmmZyC8I=; b=YANC+17nxk1CZlOrt/q8HjRcF2pkHArFmdefQ2ZTi9e43CCZomChKzmrT2NMt1F/0NJcFC b0s4u4whCI/nk9BQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709217611; h=from:from:reply-to: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=hNpKbYqfzuf/MaKse8ndi5jx0DwmYBrPj+7dmmZyC8I=; b=0Y/aHk0tn25s0ubDCmfPYdzBpK9sCDYoER3nisWjO+b5Gy43qKtzLhYC6YFBaChyHjFN0K yXfH3RPrSqIm7ffpYccZfIFRS4ej1H7GI22FgszE4FMUT/njxfCgeU1/YaC6sYUyaa1qR7 XJa987R1tPwdx2O5cxIoMHnhR2zM2Hg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709217611; h=from:from:reply-to: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=hNpKbYqfzuf/MaKse8ndi5jx0DwmYBrPj+7dmmZyC8I=; b=YANC+17nxk1CZlOrt/q8HjRcF2pkHArFmdefQ2ZTi9e43CCZomChKzmrT2NMt1F/0NJcFC b0s4u4whCI/nk9BQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id ED0D213A4B; Thu, 29 Feb 2024 14:40:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id bPaiLEqX4GVgIwAAD6G6ig (envelope-from ); Thu, 29 Feb 2024 14:40:10 +0000 From: Fabiano Rosas To: Zhao Liu , Markus Armbruster , Michael Roth , Michael Tokarev , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Zhao Liu , Peter Xu Subject: Re: [PATCH 14/17] migration/option: Fix missing ERRP_GUARD() for error_prepend() In-Reply-To: <20240229143914.1977550-15-zhao1.liu@linux.intel.com> References: <20240229143914.1977550-1-zhao1.liu@linux.intel.com> <20240229143914.1977550-15-zhao1.liu@linux.intel.com> Date: Thu, 29 Feb 2024 11:39:36 -0300 Message-ID: <87jzmnz653.fsf@suse.de> MIME-Version: 1.0 Content-Type: text/plain Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [-2.95 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-2.85)[99.36%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_SEVEN(0.00)[9]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Score: -2.95 Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, 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: Thu, 29 Feb 2024 14:40:17 -0000 Zhao Liu writes: > 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 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]. > > The migrate_params_check() passes @errp to error_prepend() without > ERRP_GUARD(), and it could be called from migration_object_init(), > where the passed @errp points to @error_fatal. > > Therefore, the error message echoed in error_prepend() will be lost > because of the above issue. > > To fix this, add missing ERRP_GUARD() at the beginning of this function. > > [1]: Issue description in the commit message of commit ae7c80a7bd73 > ("error: New macro ERRP_GUARD()"). > > Cc: Peter Xu > Cc: Fabiano Rosas > Signed-off-by: Zhao Liu Reviewed-by: Fabiano Rosas