[PATCH] tools/xenstored: remove unneeded check in create_node()

Juergen Gross posted 1 patch 2 days, 7 hours ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20260330163153.676464-1-jgross@suse.com
tools/xenstored/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] tools/xenstored: remove unneeded check in create_node()
Posted by Juergen Gross 2 days, 7 hours ago
create_node() is called only for issued xenstore commands. This means
that the "conn" parameter is never NULL.

Remove checking whether "conn" is not NULL.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstored/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index 4786a2a82e..34cb266e8a 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -1524,7 +1524,7 @@ static struct node *create_node(struct connection *conn, const void *ctx,
 	if (!node)
 		return NULL;
 
-	if (conn && conn->transaction)
+	if (conn->transaction)
 		ta_node_created(conn->transaction);
 
 	node->data = data;
-- 
2.53.0
Re: [PATCH] tools/xenstored: remove unneeded check in create_node()
Posted by Jan Beulich 1 day, 17 hours ago
On 30.03.2026 18:31, Juergen Gross wrote:
> create_node() is called only for issued xenstore commands. This means
> that the "conn" parameter is never NULL.
> 
> Remove checking whether "conn" is not NULL.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Should Coverity ID 1690859 perhaps be mentioned, as presumably addressed
by this? (If it is addressed by the change, the question of possibly
backporting would then also arise.)

Jan

> --- a/tools/xenstored/core.c
> +++ b/tools/xenstored/core.c
> @@ -1524,7 +1524,7 @@ static struct node *create_node(struct connection *conn, const void *ctx,
>  	if (!node)
>  		return NULL;
>  
> -	if (conn && conn->transaction)
> +	if (conn->transaction)
>  		ta_node_created(conn->transaction);
>  
>  	node->data = data;
Re: [PATCH] tools/xenstored: remove unneeded check in create_node()
Posted by Jürgen Groß 1 day, 16 hours ago
On 31.03.26 08:04, Jan Beulich wrote:
> On 30.03.2026 18:31, Juergen Gross wrote:
>> create_node() is called only for issued xenstore commands. This means
>> that the "conn" parameter is never NULL.
>>
>> Remove checking whether "conn" is not NULL.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
> 
> Should Coverity ID 1690859 perhaps be mentioned, as presumably addressed
> by this? (If it is addressed by the change, the question of possibly
> backporting would then also arise.)

I'm not sure this will really address Coverity ID 1690859. It would be just
an "educated guess".

And regarding backporting - this isn't fixing a bug, it is just a minor
optimization.

It might even be that in older versions the check is needed. One would have
to verify that there isn't any call patch with conn == NULL.


Juergen