All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zenghui Yu <yuzenghui@huawei.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Jing Zhang <jingzhangos@google.com>, <kvmarm@lists.linux.dev>
Subject: Re: [bug report] KVM: arm64: vgic-its: Add debugfs interface to expose ITS tables
Date: Thu, 29 May 2025 21:01:04 +0800	[thread overview]
Message-ID: <220ce0f4-afa6-09e3-a05b-a3ba1ebb61be@huawei.com> (raw)
In-Reply-To: <aDBylI1YnjPatAbr@stanley.mountain>

Hi Dan,

On 2025/5/23 21:05, Dan Carpenter wrote:
> Hello Jing Zhang,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> Commit 30deb51a677b ("KVM: arm64: vgic-its: Add debugfs interface to
> expose ITS tables") from Feb 20, 2025, leads to the following Smatch
> complaint:
> 
>     arch/arm64/kvm/vgic/vgic-debug.c:501 vgic_its_debug_show()
>     warn: variable dereferenced before check 'ite' (see line 493)
> 
> arch/arm64/kvm/vgic/vgic-debug.c
>    492	
>    493		if (list_is_first(&ite->ite_list, &dev->itt_head)) {
>                                    ^^^^^^^^^^^^^
> This dereferences "ite"

could be a NULL pointer dereference if, e.g., *no* interrupt has been
mapped into an ITE (associated with this device).

> 
>    494			seq_printf(s, "\n");
>    495			seq_printf(s, "Device ID: 0x%x, Event ID Range: [0 - %llu]\n",
>    496				   dev->device_id, BIT_ULL(dev->num_eventid_bits) - 1);
>    497			seq_printf(s, "EVENT_ID    INTID  HWINTID   TARGET   COL_ID HW\n");
>    498			seq_printf(s, "-----------------------------------------------\n");
>    499		}
>    500	
>    501		if (ite && ite->irq && ite->collection) {
>                     ^^^
> So this check is too late.

So this definitely needs to be fixed. Thanks for the report!

Zenghui

      reply	other threads:[~2025-05-29 13:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23 13:05 [bug report] KVM: arm64: vgic-its: Add debugfs interface to expose ITS tables Dan Carpenter
2025-05-29 13:01 ` Zenghui Yu [this message]

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=220ce0f4-afa6-09e3-a05b-a3ba1ebb61be@huawei.com \
    --to=yuzenghui@huawei.com \
    --cc=dan.carpenter@linaro.org \
    --cc=jingzhangos@google.com \
    --cc=kvmarm@lists.linux.dev \
    /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.