From: Vikram Garhwal <vikram.garhwal@amd.com>
To: Javi Merino <javi.merino@cloud.com>
Cc: xen-devel@lists.xenproject.org, Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [PATCH v2] xen/common: Don't dereference overlay_node after checking that it is NULL
Date: Thu, 11 Jan 2024 13:51:24 -0800 [thread overview]
Message-ID: <ZaBi3J0aZn3NJUBQ@amd.com> (raw)
In-Reply-To: <18b7b16d0cce886728410784a7b6063116be7e2d.1704970589.git.javi.merino@cloud.com>
On Thu, Jan 11, 2024 at 12:09:27PM +0000, Javi Merino wrote:
> In remove_nodes(), overlay_node is dereferenced when printing the
> error message even though it is known to be NULL. Return without
> printing as an error message is already printed by the caller.
>
> The semantic patch that spots this code is available in
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/coccinelle/null/deref_null.cocci?id=1f874787ed9a2d78ed59cb21d0d90ac0178eceb0
>
> Fixes: 7e5c4a8b86f1 ("xen/arm: Implement device tree node removal functionalities")
> Signed-off-by: Javi Merino <javi.merino@cloud.com>
Reviewed-by: Vikram Garhwal <vikram.garhwal@amd.com>
> ---
> CC: Vikram Garhwal <vikram.garhwal@amd.com>
> CC: Julien Grall <julien@xen.org>
>
> xen/common/dt-overlay.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
> index 5663a049e90a..1b197381f616 100644
> --- a/xen/common/dt-overlay.c
> +++ b/xen/common/dt-overlay.c
> @@ -427,11 +427,7 @@ static int remove_nodes(const struct overlay_track *tracker)
> {
> overlay_node = (struct dt_device_node *)tracker->nodes_address[j];
> if ( overlay_node == NULL )
> - {
> - printk(XENLOG_ERR "Device %s is not present in the tree. Removing nodes failed\n",
> - overlay_node->full_name);
> return -EINVAL;
> - }
>
> rc = remove_descendant_nodes_resources(overlay_node);
> if ( rc )
> --
> 2.42.0
>
next prev parent reply other threads:[~2024-01-11 21:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-11 12:09 [PATCH v2] xen/common: Don't dereference overlay_node after checking that it is NULL Javi Merino
2024-01-11 21:51 ` Vikram Garhwal [this message]
2024-01-12 11:04 ` Julien Grall
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=ZaBi3J0aZn3NJUBQ@amd.com \
--to=vikram.garhwal@amd.com \
--cc=javi.merino@cloud.com \
--cc=julien@xen.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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.