From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48573C4338F for ; Wed, 25 Aug 2021 04:24:19 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id ED5316109F for ; Wed, 25 Aug 2021 04:24:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org ED5316109F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:53540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIkSY-0000EE-2t for qemu-devel@archiver.kernel.org; Wed, 25 Aug 2021 00:24:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIkGf-0000ih-Fd; Wed, 25 Aug 2021 00:12:01 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:34773 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIkGd-0007UH-54; Wed, 25 Aug 2021 00:12:00 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4GvXbv0Cr4z9t1s; Wed, 25 Aug 2021 14:11:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1629864699; bh=KUjvSXLaPBElb14YlGjqlr/yPPG1S3QimQFa3b1SKX0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ErdvnorpMsh2QSpYMMLP4vksgfm0akCcGT66l/2wFvekXJFbnVbG7tFfB2hR1UpKC ojEVhWb4Wrkd2y/RHIJCC1WpQTM5eep+WDNfyFHEDdANuKysKCz5/gcznFS4oBuz6u kiIPAVUg9sd4AyzfHAkVgCYrgRl4sHIYNVcNl300= Date: Wed, 25 Aug 2021 13:50:09 +1000 From: David Gibson To: Daniel Henrique Barboza Subject: Re: [PATCH v7 3/7] spapr_drc.c: do not error_report() when drc->dev->id == NULL Message-ID: References: <20210825004835.472919-1-danielhb413@gmail.com> <20210825004835.472919-4-danielhb413@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qsdsl/TTsD2FcioZ" Content-Disposition: inline In-Reply-To: <20210825004835.472919-4-danielhb413@gmail.com> Received-SPF: pass client-ip=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: armbru@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, groug@kaod.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --qsdsl/TTsD2FcioZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 24, 2021 at 09:48:31PM -0300, Daniel Henrique Barboza wrote: > The error_report() call in drc_unisolate_logical() is not considering > that drc->dev->id can be NULL, and the underlying functions error_report() > calls to do its job (vprintf(), g_strdup_printf() ...) has undefined > behavior when trying to handle "%s" with NULL arguments. >=20 > Besides, there is no utility into reporting that an unknown device was > rejected by the guest. >=20 > Reviewed-by: Greg Kurz > Reviewed-by: Markus Armbruster > Signed-off-by: Daniel Henrique Barboza Acked-by: David Gibson > --- > hw/ppc/spapr_drc.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) >=20 > diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c > index a2f2634601..a4d9496f76 100644 > --- a/hw/ppc/spapr_drc.c > +++ b/hw/ppc/spapr_drc.c > @@ -167,8 +167,11 @@ static uint32_t drc_unisolate_logical(SpaprDrc *drc) > } > =20 > drc->unplug_requested =3D false; > - error_report("Device hotunplug rejected by the guest " > - "for device %s", drc->dev->id); > + > + if (drc->dev->id) { > + error_report("Device hotunplug rejected by the guest " > + "for device %s", drc->dev->id); > + } > =20 > /* > * TODO: send a QAPI DEVICE_UNPLUG_ERROR event when --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --qsdsl/TTsD2FcioZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAmElvfEACgkQbDjKyiDZ s5K5fg/+OK+MYeb4XL251XtByvdh55dLHPC1Yp8/Nj94ACY84IG+gG0Hf1LjJ1mD rZImQKpV2uS/6Qs68vXFNFU8EEURMbhDLcZTSRZ614VTOQDDqlVOME5BbopEQzbZ qqzYhYsEV7zIhdv6sp6Hy9h34Uoeuq51lgyM8i9BtanrBogxr7BamqSkIKKNzPbj epyZtiSL0QK///Y1+lS7Joxi5OZTm3b6BidZGQlWC91gxN7I6nbJ2J3VfMMXTYTD NEnI2ZjsqSyPomfdSOhOBzZdeHfvg4WBB88UNgWTuN72oZZRMpm+qf4/6sXoGOhe 3C/O9yTDmy9u2jPT+OUrHgoHmNL4yuPJ55BbwiOwyV7I44ZMvzozxOUaWuZMRGGO NZWtG+okD/h3YY7gqWp1G9KHHmpTJoGuXBHR7A4cYAowDxir3HVEY2jK9ZiRI0hn 22B3Ew9zRCl8rlp9XYDnoxOxGENVVShvy0HmfDDC0KTHAhVYUWMTa4EzdoEt9E8y 1EsViMTAIG7YytPknTfUC6VHM3t1Mpv45YJnSODeKvkWlAsDwxbUCzxnef1coMIf m3JDZ9Cj7zmr38YiTEPVtnPh5m5ZlAwfHzcfUrrv0oGPGCECBOxveHPahmtDFqUA zgYjrXZ7JlgQx429IRfbthxjVOvlFhgwXTpXawp9WuhyyTEHXbc= =nFIO -----END PGP SIGNATURE----- --qsdsl/TTsD2FcioZ--