Linux Trace Kernel
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Sang-Heon Jeon <ekffu200098@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH] bootconfig: remove unreachable index checks in xbc_verify_tree()
Date: Tue, 8 Sep 2026 10:46:29 +0900	[thread overview]
Message-ID: <20260908104629.e7a85a90e376b843dbc51dc7@kernel.org> (raw)
In-Reply-To: <20260905141637.1547429-1-ekffu200098@gmail.com>

On Sat,  5 Sep 2026 23:16:36 +0900
Sang-Heon Jeon <ekffu200098@gmail.com> wrote:

> xbc_verify_tree() checks that every node's next and child are below
> xbc_node_num. Both fields store the index of an existing node, which
> is below xbc_node_num.

This is a kind of foolpoof/defensive checking. (so I call it verify.)

> 
> So remove the checks.
> 
> No functional change.

Hmm, OK, I think we should decouple the logic/implementation
verification from runtime verification (e.g. wrong format)
and move the former to tools/bootconfig.

Thank you,

> 
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> ---
>  lib/bootconfig.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> index 89c88e359179..d383430637ee 100644
> --- a/lib/bootconfig.c
> +++ b/lib/bootconfig.c
> @@ -1005,7 +1005,7 @@ static int __init xbc_close_brace(char **k, char *n)
>  
>  static int __init xbc_verify_tree(void)
>  {
> -	int i, depth;
> +	int depth;
>  	size_t len, wlen;
>  	struct xbc_node *n, *m;
>  
> @@ -1022,17 +1022,6 @@ static int __init xbc_verify_tree(void)
>  		return -ENOENT;
>  	}
>  
> -	for (i = 0; i < xbc_node_num; i++) {
> -		if (xbc_nodes[i].next >= xbc_node_num) {
> -			return xbc_parse_error("No closing brace",
> -				xbc_node_get_data(xbc_nodes + i));
> -		}
> -		if (xbc_nodes[i].child >= xbc_node_num) {
> -			return xbc_parse_error("Broken child node",
> -				xbc_node_get_data(xbc_nodes + i));
> -		}
> -	}
> -
>  	/* Key tree limitation check */
>  	n = &xbc_nodes[0];
>  	depth = 1;
> -- 
> 2.43.0
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

  reply	other threads:[~2026-09-08  1:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-05 14:16 [PATCH] bootconfig: remove unreachable index checks in xbc_verify_tree() Sang-Heon Jeon
2026-09-08  1:46 ` Masami Hiramatsu [this message]
2026-09-08 15:34   ` Sang-Heon Jeon
2026-09-08 23:24     ` Masami Hiramatsu
2026-09-09  1:27       ` Sang-Heon Jeon

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=20260908104629.e7a85a90e376b843dbc51dc7@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=ekffu200098@gmail.com \
    --cc=linux-trace-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox