All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-4.18 v1] xen/common: Don't dereference overlay_node after checking that it is NULL
@ 2024-01-09 14:19 Javi Merino
  2024-01-09 15:31 ` Julien Grall
  0 siblings, 1 reply; 7+ messages in thread
From: Javi Merino @ 2024-01-09 14:19 UTC (permalink / raw)
  To: xen-devel; +Cc: Javi Merino, Vikram Garhwal, Stefano Stabellini, Julien Grall

In remove_nodes(), overlay_node is dereferenced when printing the
error message even though it is known to be NULLL.  Fix the error
message to avoid dereferencing a NULL pointer.

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>
---
CC: Vikram Garhwal <vikram.garhwal@amd.com>

Vikram, I didn't know what to put in the error message.  Feel free to
suggest something more appropriate than "Device not present in the
tree".

---
 xen/common/dt-overlay.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
index 5663a049e90a..f04b0c276eea 100644
--- a/xen/common/dt-overlay.c
+++ b/xen/common/dt-overlay.c
@@ -428,8 +428,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);
+            printk(XENLOG_ERR "Device not present in the tree. Removing nodes failed\n");
             return -EINVAL;
         }
 
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-01-11 10:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-09 14:19 [PATCH for-4.18 v1] xen/common: Don't dereference overlay_node after checking that it is NULL Javi Merino
2024-01-09 15:31 ` Julien Grall
2024-01-09 15:42   ` Javi Merino
2024-01-09 15:50     ` Julien Grall
2024-01-09 17:51       ` Javi Merino
2024-01-10 20:25   ` Vikram Garhwal
2024-01-11 10:49     ` Javi Merino

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.