From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: Srivatsa Vaddagiri <quic_svaddagi@quicinc.com>,
peter.maydell@linaro.org, alex.bennee@linaro.org,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
Peter Xu <peterx@redhat.com>,
quic_tsoni@quicinc.com, quic_pheragu@quicinc.com,
quic_eberman@quicinc.com, quic_yvasi@quicinc.com,
quic_cvanscha@quicinc.com, quic_mnalajal@quicinc.com,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [RFC/PATCH v0 01/12] hw/arm/virt: Avoid NULL pointer de-reference
Date: Thu, 12 Oct 2023 07:02:39 +0200 [thread overview]
Message-ID: <875y3cph5c.fsf@pond.sub.org> (raw)
In-Reply-To: <b98e4566-56b4-d0e4-adb2-c163c7c26cfb@linaro.org> ("Philippe Mathieu-Daudé"'s message of "Thu, 12 Oct 2023 06:30:24 +0200")
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> Hi Srivatsa,
>
> (+Markus/Peter for QOM fu)
QOM fu needs Paolo; cc'ed.
I'm not sure how much this is about QOM, though. Perhaps it's more
about good taste.
> On 11/10/23 18:52, Srivatsa Vaddagiri wrote:
>> Avoid dereferencing a NULL pointer that its_class_name() could return.
>
> While your patch is correct, there is some code smell
> around its_class_name(). IMHO a foo_class_name() handler
> should never return NULL.
>
> I'm trying to rework apic_get_class() similarly, see:
> https://lore.kernel.org/qemu-devel/20231003082728.83496-1-philmd@linaro.org/
In both cases, we have a function to find the device model to use with
current QEMU configuration and system state. The fact that one of them
returns a class name and the other a class is detail.
Observe: this usable device model exists for any QEMU configuration. It
may not be usable in certain system states, though.
Since the function deals with both, it can fail.
We can separate the two concerns: first map configuration to device
model (can't fail), then check the system state (can fail).
Feels like a matter of taste to me. Does it result in simpler function
contracts and more readable code? Can we do it the same way everywhere?
next prev parent reply other threads:[~2023-10-12 5:02 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-11 16:52 [RFC/PATCH v0 00/12] Gunyah hypervisor support Srivatsa Vaddagiri
2023-10-11 16:52 ` [RFC/PATCH v0 01/12] hw/arm/virt: Avoid NULL pointer de-reference Srivatsa Vaddagiri
2023-10-12 4:30 ` Philippe Mathieu-Daudé
2023-10-12 5:02 ` Markus Armbruster [this message]
2023-10-12 12:24 ` Srivatsa Vaddagiri
2023-10-11 16:52 ` [RFC/PATCH v0 02/12] update-linux-headers: Include gunyah.h Srivatsa Vaddagiri
2023-10-11 16:57 ` Srivatsa Vaddagiri
2023-11-29 16:44 ` Alex Bennée
2023-12-01 10:35 ` Srivatsa Vaddagiri
2023-10-11 16:52 ` [RFC/PATCH v0 03/12] gunyah: Basic support Srivatsa Vaddagiri
2023-10-12 4:33 ` Philippe Mathieu-Daudé
2023-10-12 11:32 ` Alex Bennée
2023-10-12 12:24 ` Srivatsa Vaddagiri
2023-11-29 16:56 ` Alex Bennée
2023-12-01 10:33 ` Srivatsa Vaddagiri
2023-10-11 16:52 ` [RFC/PATCH v0 04/12] gunyah: Add VM properties Srivatsa Vaddagiri
2023-10-11 16:52 ` [RFC/PATCH v0 05/12] gunyah: Support memory assignment Srivatsa Vaddagiri
2023-10-11 16:52 ` [RFC/PATCH v0 06/12] gunyah: Add IRQFD and IOEVENTFD functions Srivatsa Vaddagiri
2023-10-11 16:52 ` [RFC/PATCH v0 07/12] gunyah: Add gicv3 interrupt controller Srivatsa Vaddagiri
2023-10-11 16:52 ` [RFC/PATCH v0 08/12] gunyah: Specific device-tree location Srivatsa Vaddagiri
2023-10-12 4:35 ` Philippe Mathieu-Daudé
2023-10-11 16:52 ` [RFC/PATCH v0 09/12] gunyah: Customize device-tree Srivatsa Vaddagiri
2023-10-12 4:36 ` Philippe Mathieu-Daudé
2023-10-11 16:52 ` [RFC/PATCH v0 10/12] gunyah: CPU execution loop Srivatsa Vaddagiri
2023-10-12 4:43 ` Philippe Mathieu-Daudé
2023-10-12 12:25 ` Srivatsa Vaddagiri
2023-10-11 16:52 ` [RFC/PATCH v0 11/12] gunyah: Workarounds (NOT FOR MERGE) Srivatsa Vaddagiri
2023-10-11 16:52 ` [RFC/PATCH v0 12/12] gunyah: Documentation Srivatsa Vaddagiri
2023-10-12 4:52 ` Philippe Mathieu-Daudé
2023-10-12 12:33 ` Srivatsa Vaddagiri
2023-10-12 14:55 ` Alex Bennée
2023-10-17 9:21 ` Srivatsa Vaddagiri
2023-10-18 15:54 ` Alex Bennée
2023-10-18 16:40 ` [RFC/PATCH v0 00/12] Gunyah hypervisor support Paolo Bonzini
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=875y3cph5c.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quic_cvanscha@quicinc.com \
--cc=quic_eberman@quicinc.com \
--cc=quic_mnalajal@quicinc.com \
--cc=quic_pheragu@quicinc.com \
--cc=quic_svaddagi@quicinc.com \
--cc=quic_tsoni@quicinc.com \
--cc=quic_yvasi@quicinc.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: link
Be 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.