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

Re: [PATCH for-4.18 v1] xen/common: Don't dereference overlay_node after checking that it is NULL



Hi Javi,

Title: Any reason this is titled for-4.18? Shouldn't this patch also be merged in staging?

On 09/01/2024 14:19, Javi Merino wrote:
In remove_nodes(), overlay_node is dereferenced when printing the
error message even though it is known to be NULLL.  Fix the error

Typo: s/NULLL/NULL/

This can be fixed on commit if there is nothing else.

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

Good catch and glad to see that coccinelle can work on Xen. I am looking forward for more work in that area :).


Fixes: 7e5c4a8b86f1 ("xen/arm: Implement device tree node removal 
functionalities")
Signed-off-by: Javi Merino <javi.merino@xxxxxxxxx>
c> ---
CC: Vikram Garhwal <vikram.garhwal@xxxxxxx>

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".

More questions for Vikram, looking at the code, it is not 100% clear in which condition overlay_node could be NULL. Is this a programming error? if so, maybe this should be an ASSERT_UNREACHABLE() (could be added separately) and it would be fine to print nothing.

Cheers,

--
Julien Grall



 


Rackspace

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