qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC/PATCH v0 01/12] hw/arm/virt: Avoid NULL pointer de-reference


From: Philippe Mathieu-Daudé
Subject: Re: [RFC/PATCH v0 01/12] hw/arm/virt: Avoid NULL pointer de-reference
Date: Thu, 12 Oct 2023 06:30:24 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1

Hi Srivatsa,

(+Markus/Peter for QOM fu)

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/

Signed-off-by: Srivatsa Vaddagiri <quic_svaddagi@quicinc.com>
---
  hw/arm/virt.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index a13c658bbf..b55d5c7282 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -661,7 +661,7 @@ static void create_its(VirtMachineState *vms)
      const char *itsclass = its_class_name();
      DeviceState *dev;
- if (!strcmp(itsclass, "arm-gicv3-its")) {
+    if (itsclass && !strcmp(itsclass, "arm-gicv3-its")) {
          if (!vms->tcg_its) {
              itsclass = NULL;
          }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]