From: "Philippe Mathieu-Daudé" <f4bug@amsat.org> To: qemu-devel@nongnu.org Cc: "Peter Maydell" <peter.maydell@linaro.org>, "Sagar Karandikar" <sagark@eecs.berkeley.edu>, "Michael S. Tsirkin" <mst@redhat.com>, "Jason Wang" <jasowang@redhat.com>, "Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>, "Alistair Francis" <Alistair.Francis@wdc.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, "Subbaraya Sundeep" <sundeep.lkml@gmail.com>, qemu-block@nongnu.org, "Markus Armbruster" <armbru@redhat.com>, "Aleksandar Markovic" <aleksandar.qemu.devel@gmail.com>, "Max Reitz" <mreitz@redhat.com>, "Joel Stanley" <joel@jms.id.au>, "Palmer Dabbelt" <palmer@dabbelt.com>, "Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>, "David Gibson" <david@gibson.dropbear.id.au>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, "Eduardo Habkost" <ehabkost@redhat.com>, "Alistair Francis" <alistair@alistair23.me>, "Beniamino Galvani" <b.galvani@gmail.com>, qemu-arm@nongnu.org, "Cédric Le Goater" <clg@kaod.org>, "Richard Henderson" <rth@twiddle.net>, "Kevin Wolf" <kwolf@redhat.com>, qemu-riscv@nongnu.org, "Andrew Jeffery" <andrew@aj.id.au>, "Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, "Andrew Baumann" <Andrew.Baumann@microsoft.com>, "Jean-Christophe Dubois" <jcd@tribudubois.net>, "Michael Walle" <michael@walle.cc>, qemu-ppc@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>, "Aurelien Jarno" <aurelien@aurel32.net> Subject: [PATCH-for-5.1 v3 18/23] hw/i386/x86: Add missing error-propagation code Date: Mon, 13 Apr 2020 00:41:39 +0200 [thread overview] Message-ID: <20200412224144.12205-19-f4bug@amsat.org> (raw) In-Reply-To: <20200412224144.12205-1-f4bug@amsat.org> Running the coccinelle script: $ spatch \ --macro-file scripts/cocci-macro-file.h --include-headers \ --sp-file scripts/coccinelle/add-missing-error_propagate.cocci \ --keep-comments --smpl-spacing --dir hw inserted a block after object_property_set_uint("apic-id") which calls error_propagate() and return. Thanksfully code review noticed returning here would skip the 'object_unref(cpu)' call. Manually fix the error propagation code by adding a label to the existing call. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- hw/i386/x86.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index b82770024c..ec807ce94f 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -124,8 +124,12 @@ void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp) cpu = object_new(MACHINE(x86ms)->cpu_type); object_property_set_uint(cpu, apic_id, "apic-id", &local_err); + if (local_err) { + goto out; + } object_property_set_bool(cpu, true, "realized", &local_err); +out: object_unref(cpu); error_propagate(errp, local_err); } -- 2.21.1
WARNING: multiple messages have this Message-ID (diff)
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org> To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, "Richard Henderson" <rth@twiddle.net>, "Michael S. Tsirkin" <mst@redhat.com>, qemu-ppc@nongnu.org, "Beniamino Galvani" <b.galvani@gmail.com>, "David Gibson" <david@gibson.dropbear.id.au>, "Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>, "Andrew Jeffery" <andrew@aj.id.au>, "Alistair Francis" <Alistair.Francis@wdc.com>, "Eduardo Habkost" <ehabkost@redhat.com>, "Andrew Baumann" <Andrew.Baumann@microsoft.com>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, "Palmer Dabbelt" <palmer@dabbelt.com>, "Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, qemu-riscv@nongnu.org, "Sagar Karandikar" <sagark@eecs.berkeley.edu>, "Alistair Francis" <alistair@alistair23.me>, "Jason Wang" <jasowang@redhat.com>, "Aleksandar Markovic" <aleksandar.qemu.devel@gmail.com>, "Peter Maydell" <peter.maydell@linaro.org>, "Paolo Bonzini" <pbonzini@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>, "Aurelien Jarno" <aurelien@aurel32.net>, "Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>, qemu-arm@nongnu.org, "Michael Walle" <michael@walle.cc>, "Joel Stanley" <joel@jms.id.au>, "Jean-Christophe Dubois" <jcd@tribudubois.net>, "Subbaraya Sundeep" <sundeep.lkml@gmail.com>, "Markus Armbruster" <armbru@redhat.com>, "Max Reitz" <mreitz@redhat.com>, "Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, "Philippe Mathieu-Daudé" <f4bug@amsat.org> Subject: [PATCH-for-5.1 v3 18/23] hw/i386/x86: Add missing error-propagation code Date: Mon, 13 Apr 2020 00:41:39 +0200 [thread overview] Message-ID: <20200412224144.12205-19-f4bug@amsat.org> (raw) In-Reply-To: <20200412224144.12205-1-f4bug@amsat.org> Running the coccinelle script: $ spatch \ --macro-file scripts/cocci-macro-file.h --include-headers \ --sp-file scripts/coccinelle/add-missing-error_propagate.cocci \ --keep-comments --smpl-spacing --dir hw inserted a block after object_property_set_uint("apic-id") which calls error_propagate() and return. Thanksfully code review noticed returning here would skip the 'object_unref(cpu)' call. Manually fix the error propagation code by adding a label to the existing call. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- hw/i386/x86.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index b82770024c..ec807ce94f 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -124,8 +124,12 @@ void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp) cpu = object_new(MACHINE(x86ms)->cpu_type); object_property_set_uint(cpu, apic_id, "apic-id", &local_err); + if (local_err) { + goto out; + } object_property_set_bool(cpu, true, "realized", &local_err); +out: object_unref(cpu); error_propagate(errp, local_err); } -- 2.21.1
next prev parent reply other threads:[~2020-04-12 23:02 UTC|newest] Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-12 22:41 [PATCH-for-5.1 v3 00/23] various: Fix error-propagation with Coccinelle scripts (part 2) Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 01/23] scripts/coccinelle: Catch missing error_propagate() calls in realize() Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-14 12:40 ` Markus Armbruster 2020-04-14 12:40 ` Markus Armbruster 2020-04-14 13:24 ` Markus Armbruster 2020-04-14 13:24 ` Markus Armbruster 2020-04-12 22:41 ` [PATCH-for-5.1 v3 02/23] hw/arm/fsl-imx: Add missing error-propagation code Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 03/23] hw/arm/stm32f*05_soc: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 04/23] hw/arm/aspeed: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 05/23] hw/arm/allwinner-a10: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 06/23] hw/arm/msf2-soc: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-13 15:57 ` Alistair Francis 2020-04-13 15:57 ` Alistair Francis 2020-04-12 22:41 ` [PATCH-for-5.1 v3 07/23] hw/riscv/sifive: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-13 22:12 ` Alistair Francis 2020-04-13 22:12 ` Alistair Francis 2020-04-12 22:41 ` [PATCH-for-5.1 v3 08/23] hw/arm/armv7m: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-13 22:10 ` Alistair Francis 2020-04-13 22:10 ` Alistair Francis 2020-04-12 22:41 ` [PATCH-for-5.1 v3 09/23] hw/intc/arm_gicv3_its_kvm: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 10/23] hw/microblaze/xlnx-zynqmp-pmu: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-13 22:13 ` Alistair Francis 2020-04-13 22:13 ` Alistair Francis 2020-04-12 22:41 ` [PATCH-for-5.1 v3 11/23] hw/pci-host/pnv_phb3: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-14 2:12 ` David Gibson 2020-04-14 2:12 ` David Gibson 2020-04-12 22:41 ` [PATCH-for-5.1 v3 12/23] hw/block/onenand: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 13/23] scripts/coccinelle: Add script to catch missing error_propagate() calls Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 14/23] hw/arm/bcm2835_peripherals: Add missing error-propagation code Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 15/23] hw/arm/fsl-imx: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 16/23] hw/arm/stm32fx05_soc: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 17/23] hw/dma/xilinx_axidma: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé [this message] 2020-04-12 22:41 ` [PATCH-for-5.1 v3 18/23] hw/i386/x86: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 19/23] hw/mips/cps: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 20/23] hw/misc/macio/macio: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 21/23] hw/net/xilinx_axienet: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 22/23] hw/riscv/sifive_u: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-12 22:41 ` [PATCH-for-5.1 v3 23/23] hw/sd/milkymist-memcard: " Philippe Mathieu-Daudé 2020-04-12 22:41 ` Philippe Mathieu-Daudé 2020-04-13 1:30 ` [PATCH-for-5.1 v3 00/23] various: Fix error-propagation with Coccinelle scripts (part 2) no-reply 2020-04-13 1:30 ` no-reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200412224144.12205-19-f4bug@amsat.org \ --to=f4bug@amsat.org \ --cc=Alistair.Francis@wdc.com \ --cc=Andrew.Baumann@microsoft.com \ --cc=aleksandar.qemu.devel@gmail.com \ --cc=aleksandar.rikalo@rt-rk.com \ --cc=alistair@alistair23.me \ --cc=andrew@aj.id.au \ --cc=armbru@redhat.com \ --cc=aurelien@aurel32.net \ --cc=b.galvani@gmail.com \ --cc=clg@kaod.org \ --cc=david@gibson.dropbear.id.au \ --cc=edgar.iglesias@gmail.com \ --cc=ehabkost@redhat.com \ --cc=jasowang@redhat.com \ --cc=jcd@tribudubois.net \ --cc=joel@jms.id.au \ --cc=kbastian@mail.uni-paderborn.de \ --cc=kwolf@redhat.com \ --cc=mark.cave-ayland@ilande.co.uk \ --cc=michael@walle.cc \ --cc=mreitz@redhat.com \ --cc=mst@redhat.com \ --cc=palmer@dabbelt.com \ --cc=pbonzini@redhat.com \ --cc=peter.maydell@linaro.org \ --cc=philmd@redhat.com \ --cc=qemu-arm@nongnu.org \ --cc=qemu-block@nongnu.org \ --cc=qemu-devel@nongnu.org \ --cc=qemu-ppc@nongnu.org \ --cc=qemu-riscv@nongnu.org \ --cc=rth@twiddle.net \ --cc=sagark@eecs.berkeley.edu \ --cc=sundeep.lkml@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.