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

[xen master] xen/common: Don't dereference overlay_node after checking that it is NULL



commit 89c384c525fff7ec8bec1e36653d480ffcb86069
Author:     Javi Merino <javi.merino@xxxxxxxxx>
AuthorDate: Thu Jan 11 12:09:27 2024 +0000
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Fri Jan 12 11:03:36 2024 +0000

    xen/common: Don't dereference overlay_node after checking that it is NULL
    
    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@xxxxxxxxx>
    Reviewed-by: Vikram Garhwal <vikram.garhwal@xxxxxxx>
---
 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 5663a049e9..1b197381f6 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 )
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.