From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEF6E2F6170; Tue, 17 Mar 2026 16:09:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763782; cv=pass; b=IryvqZv/ilFwS6ff+emaOYolBisGUhAbAXfGxQl62tsYlwG1pDfkNkXBdu9k77AFgs05gxLJBi7RZcFIwhPI2eOWxyzM5uow55rglYBB61hxi/GvSQsKbS8ghp44oZBpGvd87nVFqo25ustasCTodEgKaGVPtQBmuvw2vVtP3Dg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763782; c=relaxed/simple; bh=wv78ftcSG/DocPbKu+mkVk4aNLSvNs5rs+zIciiAp0Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kyJjQ3yoZrLgHBezfW2KkPVoMbwcFDrqsFso10z3Js9Ii9VIlDA2yDLhJzgIdLC2bi+WKCJBA1glh6KBfKeBcB/zT7UgwWvYMZxvCIt8zG2crgHmWCDdMXiDS5UDmheWbVA3mwh0HqsQ3D3yQXfnj2gqoMg+2Em8h8Ad3rTnUd4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=dej2vRK5; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="dej2vRK5" ARC-Seal: i=1; a=rsa-sha256; t=1773763759; cv=none; d=zohomail.eu; s=zohoarc; b=OJcxc7qLHLs8sRYj7Ih3Rh58ym9+gkK8YMS8+wKcxjcfEDXE5a4RL6nJyB7L9JZ6wER3tLHcpI95J0CsRbIvRAsQdp+0Qr7Lq1KO7MuLDlK74l5Ibxsrh0TDOiy2Pxx5PczHDUh0VsGHpPlf0soMp50sLtEz7ZpICdqDSHpEovQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763759; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=G9gVzURcM86LqCKwgrK/9/RXrE3VSY5wkHPGGwsPo4M=; b=DeUud1AMmMCeDe8d0Ve/yzcqsDsoDRBezwKOIPVsKiLu1a+WOU4j2qKYAjbWl0YOzo7deBRUcnt5W7ULxChYm7O0SVwjCd3QwEplW8s70gaeu2cJemzX4vrwgpyOGCEZx+ThX6PCayRo7HNLrn857cW5Bj3MgfilVJEZQWzIddQ= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763759; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=G9gVzURcM86LqCKwgrK/9/RXrE3VSY5wkHPGGwsPo4M=; b=dej2vRK5YIolEsvjvaZEXFCAo061jdLT59osDi3RBCgL0YY+y6puAQi9T19mexn7 jZQPd6B0Z+qoTMIv+grgMYdbcQR+klbRq8atb/9arQeTVB8u3866gdPIPwqBXSvxbWu 8MOmYHzaBgjCWCfosn2fT28haZhaU1a6IVlRgXfA= Received: by mx.zoho.eu with SMTPS id 1773763758311344.17738613208166; Tue, 17 Mar 2026 17:09:18 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 01/15] lib/bootconfig: clean up comment typos and bracing Date: Tue, 17 Mar 2026 16:09:02 +0000 Message-Id: <20260317160916.33576-2-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Fixes kerneldoc typos ("initiized" and "uder") and adds a missing blank lin= e. Also fixes inconsistent if/else bracing in __xbc_add_key() and elsewhere. Signed-off-by: Josh Law --- lib/bootconfig.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/bootconfig.c b/lib/bootconfig.c index b0ef1e74e98a..d77b6533ac00 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -79,6 +79,7 @@ static inline void xbc_free_mem(void *addr, size_t size, = bool early) free(addr); } #endif + /** * xbc_get_info() - Get the information of loaded boot config * @node_size: A pointer to store the number of nodes. @@ -112,7 +113,7 @@ static int __init xbc_parse_error(const char *msg, cons= t char *p) * xbc_root_node() - Get the root node of extended boot config * * Return the address of root node of extended boot config. If the - * extended boot config is not initiized, return NULL. + * extended boot config is not initialized, return NULL. */ struct xbc_node * __init xbc_root_node(void) { @@ -364,7 +365,7 @@ struct xbc_node * __init xbc_node_find_next_leaf(struct= xbc_node *root, node =3D xbc_node_get_parent(node); if (node =3D=3D root) return NULL; - /* User passed a node which is not uder parent */ + /* User passed a node which is not under parent */ if (WARN_ON(!node)) return NULL; } @@ -472,8 +473,9 @@ static struct xbc_node * __init __xbc_add_sibling(char = *data, uint32_t flag, boo sib->next =3D xbc_node_index(node); } } - } else + } else { xbc_parse_error("Too many nodes", data); + } =20 return node; } @@ -655,9 +657,9 @@ static int __init __xbc_add_key(char *k) if (unlikely(xbc_node_num =3D=3D 0)) goto add_node; =20 - if (!last_parent) /* the first level */ + if (!last_parent) { /* the first level */ node =3D find_match_node(xbc_nodes, k); - else { + } else { child =3D xbc_node_get_child(last_parent); /* Since the value node is the first child, skip it. */ if (child && xbc_node_is_value(child)) @@ -665,9 +667,9 @@ static int __init __xbc_add_key(char *k) node =3D find_match_node(child, k); } =20 - if (node) + if (node) { last_parent =3D node; - else { + } else { add_node: node =3D xbc_add_child(k, XBC_KEY); if (!node) @@ -991,8 +993,9 @@ int __init xbc_init(const char *data, size_t size, cons= t char **emsg, int *epos) if (emsg) *emsg =3D xbc_err_msg; _xbc_exit(true); - } else + } else { ret =3D xbc_node_num; + } =20 return ret; } --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4B282F7AD2; Tue, 17 Mar 2026 16:09:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763783; cv=pass; b=K2dnvluSQ1DTPJlj998485nSoc9jPK1897WduzOelP+GIfze1T+OhpIQ74JZPXNqNe2Simf8lg3GF06k5j9S+tpEHJEXGlFcF5upNr5J01tZsB9xwA2fdGhZ0jIjlHjT/Z2sFtVmHtswmVQV0maMI95G6NxdB7HB7kkVa1qj0p0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763783; c=relaxed/simple; bh=6Fo6RSQQSEkzHn7Jh8Smo8YsAtoTRq1YRco2C0K7n18=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bp501ERFwAzVeb0ayMAoDFvFpkIhQnFfuA3Kzg5QU0HW0d4xG9c2kGyDl7inPWzSvCc6PSGxpFlQOqpg3qioPfGLzoYTK4me2CafbRGvXKCo3bo1dyl8kfXXnt2tvkN8OnnH5CRVSv9gY9s8FxgQAnHYdv+OPehDOnOsclx9BBo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=FbHePYTz; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="FbHePYTz" ARC-Seal: i=1; a=rsa-sha256; t=1773763762; cv=none; d=zohomail.eu; s=zohoarc; b=hm6TrNBrvC+ixeeIjFOBIvbDllgVHppxwvgaJADSHXN7Kp7CuvdMqQQyPxcN2kORBlHfaekiopqgah4vvUtuV9pzdGQzgn0b751ilj5t5XjH1ZNaiq7C6DRzKqGitBKXrkvJPaZyW1OalVI3xJKwLyCHWdDLHzVzAuL7N+U5OQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763762; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=vtmO6u/jqqPXfSKF2EgGWY5wmzpnk5cpwQL3qgwBYG4=; b=XXiVLEkLGwczKUkwOeSCltOlye0yyj6/qU5Li3iC5GQ0AsixkdlL6rzqp2kCu1LHyRyGvEbQALf1ozqt4i69+sA+l0BbgAtvWgrCkgD6TLM5xfkkMXSaBpwxbxTRSfkgAsWd7NUOVTa/vcklynp6bv4/CsKYNcDjTDrHSDo9+LY= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763762; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=vtmO6u/jqqPXfSKF2EgGWY5wmzpnk5cpwQL3qgwBYG4=; b=FbHePYTzV0KdRUzgifD+67TzqPP6jwSVeFGKoM5UxaBkWL7FyrJ15xxuvjn2yDg1 gbfbmRVTaXawGG0wY1E/HD7Jng112L36euN8cKOPzp36dKb7xyTVMt0y7sdmCXOLLxQ QT2xKFlvhjN7PROdNzT81igs4rcG3CGLilrhYSCA= Received: by mx.zoho.eu with SMTPS id 1773763758809468.18190920887355; Tue, 17 Mar 2026 17:09:18 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 02/15] lib/bootconfig: narrow flag parameter type from uint32_t to uint16_t Date: Tue, 17 Mar 2026 16:09:03 +0000 Message-Id: <20260317160916.33576-3-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" The flag parameter in the node creation helpers only ever carries XBC_KEY (0) or XBC_VALUE (0x8000), both of which fit in uint16_t. Using uint16_t matches the width of xbc_node.data where the flag is ultimately stored. Signed-off-by: Josh Law --- lib/bootconfig.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/bootconfig.c b/lib/bootconfig.c index d77b6533ac00..d69ec95d6062 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -408,7 +408,7 @@ const char * __init xbc_node_find_next_key_value(struct= xbc_node *root, =20 /* XBC parse and tree build */ =20 -static int __init xbc_init_node(struct xbc_node *node, char *data, uint32_= t flag) +static int __init xbc_init_node(struct xbc_node *node, char *data, uint16_= t flag) { unsigned long offset =3D data - xbc_data; =20 @@ -422,7 +422,7 @@ static int __init xbc_init_node(struct xbc_node *node, = char *data, uint32_t flag return 0; } =20 -static struct xbc_node * __init xbc_add_node(char *data, uint32_t flag) +static struct xbc_node * __init xbc_add_node(char *data, uint16_t flag) { struct xbc_node *node; =20 @@ -452,7 +452,7 @@ static inline __init struct xbc_node *xbc_last_child(st= ruct xbc_node *node) return node; } =20 -static struct xbc_node * __init __xbc_add_sibling(char *data, uint32_t fla= g, bool head) +static struct xbc_node * __init __xbc_add_sibling(char *data, uint16_t fla= g, bool head) { struct xbc_node *sib, *node =3D xbc_add_node(data, flag); =20 @@ -480,17 +480,17 @@ static struct xbc_node * __init __xbc_add_sibling(cha= r *data, uint32_t flag, boo return node; } =20 -static inline struct xbc_node * __init xbc_add_sibling(char *data, uint32_= t flag) +static inline struct xbc_node * __init xbc_add_sibling(char *data, uint16_= t flag) { return __xbc_add_sibling(data, flag, false); } =20 -static inline struct xbc_node * __init xbc_add_head_sibling(char *data, ui= nt32_t flag) +static inline struct xbc_node * __init xbc_add_head_sibling(char *data, ui= nt16_t flag) { return __xbc_add_sibling(data, flag, true); } =20 -static inline __init struct xbc_node *xbc_add_child(char *data, uint32_t f= lag) +static inline __init struct xbc_node *xbc_add_child(char *data, uint16_t f= lag) { struct xbc_node *node =3D xbc_add_sibling(data, flag); =20 --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78892257845; Tue, 17 Mar 2026 16:09:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763784; cv=pass; b=VIkr/0rZeh7vgJhMrDfLsV/bfsr/1PumDFCk5exEQiCdIcGvfq1OB8wXZOubcPGaMudMdc17+oEA/iGhyb0siNHSsMHs+DcEx8jyPZascucUxu0RcJR+MjarcKkLsDZYiE3S0EuuP+AKmr7R19KPgcslyUeYC2pJdtz0Ofdf+xU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763784; c=relaxed/simple; bh=37+w50eN12giG1sxYBeLrwDs7oYHGhVLDIPSz3ka60s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EyIH2d3bAvmG3FLzZU3z94VDkGpkV5sgLl3yfRz9cB/FtQQVoSclLbPeLMwbobvdNA5CtAGQFdRpzL1xiAvCW+6+3DhihSC9UjbGah3t9QH+Pit2FtpQTxm9/KbovXonaWjvRDSCfzaeI6DirMrul+6F/cPqVe1eZWZsqNdU6BI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=DKoB/x8a; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="DKoB/x8a" ARC-Seal: i=1; a=rsa-sha256; t=1773763762; cv=none; d=zohomail.eu; s=zohoarc; b=J/dHrJ+hU0Pbx354VF3pNimtQ2Uc8XycWTmqrPTToCooDd6DmvoXrgJvhmP5pQyX8Y6FY6hWttRHzTzDihyQmMft09ATxE18hoD1pBIg7G1UZ4t17k5dEyYWrxL8G12Rno5tQVW8hxNFoo2sc3+mJVxw2zTw+hSEQvZDhLaoo9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763762; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=pnvNz087SDFsoszDGu38Bu2rd0bClNbasbpeXh64ZgY=; b=XJaDqHeazOnuj5Yw98KasoY/6YD09ZKeRYU7OOoXGgGbfVa6PXkx1D6jzgqyXybuJI3cuTOa+lwd53IJ2qld0uALeFRR1Uex+TRhGloAeObG0wrEwNm17p38mxTCvks/gM2Z41D135d8HDFZJwKar46iLwJfaZsEy0kCipFkS5g= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763762; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=pnvNz087SDFsoszDGu38Bu2rd0bClNbasbpeXh64ZgY=; b=DKoB/x8a3bNCoQ9YsE8YuZx4A9dakwaUOl3XX/NmlQ2/LMCQU15bHQRaJxfpdW1W E3hUwikIY8QZkf70xpSutewryf3Ozx0BBT5p/egKSABLq16HGULrGjUQTZYNcHQo/pZ tCGr3Mx7bblSgt6wNa+BpDndF6EflVcldsFdIge8= Received: by mx.zoho.eu with SMTPS id 177376375930191.03908404729896; Tue, 17 Mar 2026 17:09:19 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 03/15] lib/bootconfig: fix off-by-one in xbc_verify_tree() next node check Date: Tue, 17 Mar 2026 16:09:04 +0000 Message-Id: <20260317160916.33576-4-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Valid node indices are 0 to xbc_node_num-1, so a next value equal to xbc_node_num is out of bounds. Use >=3D instead of > to catch this. A malformed or corrupt bootconfig could pass tree verification with an out-of-bounds next index. On subsequent tree traversal at boot time, xbc_node_get_next() would return a pointer past the allocated xbc_nodes array, causing an out-of-bounds read of kernel memory. Signed-off-by: Josh Law --- lib/bootconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootconfig.c b/lib/bootconfig.c index d69ec95d6062..ca668ead1db6 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -816,7 +816,7 @@ static int __init xbc_verify_tree(void) } =20 for (i =3D 0; i < xbc_node_num; i++) { - if (xbc_nodes[i].next > xbc_node_num) { + if (xbc_nodes[i].next >=3D xbc_node_num) { return xbc_parse_error("No closing brace", xbc_node_get_data(xbc_nodes + i)); } --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E875257845; Tue, 17 Mar 2026 16:11:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763890; cv=pass; b=FcrQfwxW4LPd4wNlIINTnLMtKIaPlroT0VIWaEGj5gruhILnc6EKUzKwiq297fbSbyAmQd/JnGkeZLVu37nFaFlSr0TOgxENFVYvefYwHgddHzwI/A11SJ0F2OM1PQc9yFh74qvBEG3O2r9iuWC/luiSp57SRBBQBp/tLYwDDcU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763890; c=relaxed/simple; bh=3tM5KwMKBZ8z8auFLoGZ8L6+Lizhfgkj6R4OpQaZT/c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lFlUHhdR8MrTAp96HN04ZCFdxKj1TUpHV6np5nykI5athY48HYvUExThcJfJg0jOc7unoPM/7gVLlX8kY5h3s/RWijNUCF7iNEIL8j2qYCJY1ZfKjx4Sc2xlpy4zJ1QExZV+tgQR11QImKEMfmCz935QGrC73naDOrczTuEslOk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=iaHbks4p; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="iaHbks4p" ARC-Seal: i=1; a=rsa-sha256; t=1773763761; cv=none; d=zohomail.eu; s=zohoarc; b=dAO+lMApzCSgIUy8z5Kp7xml8y3W2k5PXDyKO/LlJ07Fp565vWzLRUeqokC97vOC/58AOcjRL3evhoBrEfvtrwolsA3K+8emH+cEUKh2VruRuy4DVLoWOMnLzSE/kI7WbvFXW/+HxhK6rx61Ip1i58K247JJ5QzCvlwtJHKE9Qg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763761; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=3ndLaxyQl6N1oWzpmXGGEl1q/PrhL8WAxqF807UPVJw=; b=lEhVcAYwWAB58UvTrotwsIjiVa5RPRD6ItU24qs9r1+BxZQZ723+iOZJolYmGek+PsQoh+3gwypIJxApvLWiU3jDU8UJ+zrWH0vG5yTGurC8tbVI4xgdkXHV5efVvRqYkl4deMOEPe8pKPpkS7YOoZqlacOHUVuhDZTU86vjNwo= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763761; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=3ndLaxyQl6N1oWzpmXGGEl1q/PrhL8WAxqF807UPVJw=; b=iaHbks4pHvVK3Gf94Cy1nx51SegoW/izWACimfk9Y/SbdsV41qd5ne7lE4SbXtI+ 2u/PbsF++eIHwLJVmraZnFonaTfrq+mPAjKUlxjxTUeITE7mI2PtShSlg7s/4JhLst9 RDhctCbA7R06mpj7pPJc5k0xmiHlYyiF7hMHuXAU= Received: by mx.zoho.eu with SMTPS id 1773763759823948.8095310048836; Tue, 17 Mar 2026 17:09:19 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 04/15] lib/bootconfig: increment xbc_node_num after node init succeeds Date: Tue, 17 Mar 2026 16:09:05 +0000 Message-Id: <20260317160916.33576-5-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Move the xbc_node_num increment to after xbc_init_node() so a failed init does not leave a partially initialized node counted in the array. If xbc_init_node() fails on a data offset at the boundary of a maximum-size bootconfig, the pre-incremented count causes subsequent tree verification and traversal to consider the uninitialized node as valid, potentially leading to an out-of-bounds read or unpredictable boot behavior. Signed-off-by: Josh Law --- lib/bootconfig.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/bootconfig.c b/lib/bootconfig.c index ca668ead1db6..6b899e24189c 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -429,9 +429,10 @@ static struct xbc_node * __init xbc_add_node(char *dat= a, uint16_t flag) if (xbc_node_num =3D=3D XBC_NODE_MAX) return NULL; =20 - node =3D &xbc_nodes[xbc_node_num++]; + node =3D &xbc_nodes[xbc_node_num]; if (xbc_init_node(node, data, flag) < 0) return NULL; + xbc_node_num++; =20 return node; } --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D2392FB0A3; Tue, 17 Mar 2026 16:11:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763893; cv=pass; b=dkHvn9pPQJwZy+uFDRfXHg/AXW1M0nH2K2DS5Mv4wyi7BofJD8V6M+v/Wv8ZufgOrz4VGz8CZe/wUl+SF6E+6204ryBqueVrP3PVYPjVEYNo0Y0ErFC/OyDYdQJqO/GlVmWHYmVlXRa7BWeKs8LxWNYJSxV5oBg47nSPwoYr4OI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763893; c=relaxed/simple; bh=8XfWUpdfXEDT8M6ObTzeOjROI4BmQBiHqKqE8eCq18Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dfPBXTzCq1YiwqsXiQkaD+WdjSFMM9MLDQi4HohT6+pedSdlpfyUwI13FejAmgFxzFUZ7gRuNYDIKjjvBo+9KHosCPIMb8J5vyZ4J2hkWZg3qSQ1qA6mxDPhWfLr9CB/n//llroZPZJdYAboO350wSaE6q2ORg4LYaHFJifFZC8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=c/bwk5w/; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="c/bwk5w/" ARC-Seal: i=1; a=rsa-sha256; t=1773763761; cv=none; d=zohomail.eu; s=zohoarc; b=Q+sAeuJ0jbsS2tNOMkMOLEcT8g75s0KGnFuYoeeJXGy66t30H5U/POzWAxYnw8DLNFDfcVDuCRrrgRHof+UK2/tFjNDOViWkwFAacLWDDOphyvPbQzJ8a/DLyaJbMeW/Y0DvQq6tXgZ/TbuVLSZE0WPt3OEXr23zXrnHwX6IdIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763761; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=YuHtW7i85M2bA56G7FOBtaqwGGYTu+FTLl9HM5NlI30=; b=C/ODz/m12XFPbr5B8Mp51KluftIDsWWqDYunkRLmrFAmW6u8M6OVt/9xnR9I0qE8BiNntmo+9WQIMMpu1RPpSk1uxQu28//FAhwhH2RlhtuYtZwwd1kWkuASMnXpS4Iio6/u0Gmhy+M9JQluUO7rQ5uOYQz3jMoI0dEplSn7b1U= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763761; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=YuHtW7i85M2bA56G7FOBtaqwGGYTu+FTLl9HM5NlI30=; b=c/bwk5w/qiG3EGWJJjyiruECfx2Fb5RaXRTxSmlcTZXZEraJw5cyfI+c3jba7zb9 xUZIwIutrhk875iucyzhQ3eHvSFJmyH93yPXr5tw/Le0+ItRf0/DBRiOnF1w9W/5fS0 vH1QKH2eg6LLeJrzy9c7mMytC8dAW1lAARpaRDHw= Received: by mx.zoho.eu with SMTPS id 1773763760325916.8822714944906; Tue, 17 Mar 2026 17:09:20 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 05/15] lib/bootconfig: drop redundant memset of xbc_nodes Date: Tue, 17 Mar 2026 16:09:06 +0000 Message-Id: <20260317160916.33576-6-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" memblock_alloc() already returns zeroed memory, so the explicit memset in xbc_init() is redundant. Switch the userspace xbc_alloc_mem() from malloc() to calloc() so both paths return zeroed memory, and remove the separate memset call. Signed-off-by: Josh Law --- lib/bootconfig.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/bootconfig.c b/lib/bootconfig.c index 6b899e24189c..69486bd56fea 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -71,7 +71,7 @@ static inline void __init xbc_free_mem(void *addr, size_t= size, bool early) =20 static inline void *xbc_alloc_mem(size_t size) { - return malloc(size); + return calloc(1, size); } =20 static inline void xbc_free_mem(void *addr, size_t size, bool early) @@ -982,7 +982,6 @@ int __init xbc_init(const char *data, size_t size, cons= t char **emsg, int *epos) _xbc_exit(true); return -ENOMEM; } - memset(xbc_nodes, 0, sizeof(struct xbc_node) * XBC_NODE_MAX); =20 ret =3D xbc_parse_tree(); if (!ret) --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A43FF2FE579; Tue, 17 Mar 2026 16:11:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763894; cv=pass; b=u5Qw0iResfc8FX5Oq74VlOP3X4LUxFpblAuXl3Zv4ZQLImlEBbwsJGm8LKyutRDRMZGJVELy4MmZsWU4D8iyXZi9Q65uf9yhYXWnyQthhzoAI35PLFyZLoM/ApPrEyCpK+PIWViKyDhf6FjNZKQ14akcZnXaFFWCYl0tOkyFB8o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763894; c=relaxed/simple; bh=z4qpI5K5VuCGCL+LIB0Pg02CYIyxZaHnByIH+LUn4eI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eSncwuf+Ri8uRroEQSshtRkBOY5TAmIq2WxqpMC25ruUHunOxeUJV4sA9BPlB/OZUMWG2aQesuXpNGiYdQsXP0mhrtaj2ciWW9/fRvvPhpdPBO3wvHvKhwB+iTwbMF8W/sMeicfkEPgWEYHm+EEw2Tc1ZfocBpL3zrg+yMXuvz0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=VAl36DAp; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="VAl36DAp" ARC-Seal: i=1; a=rsa-sha256; t=1773763764; cv=none; d=zohomail.eu; s=zohoarc; b=d1xn7w0qJ0HpQyXTBZ9JwhOil3vVLpqqbFh9i3zc6qFUedRMbRmtEAyx93VTUYD/STIhfOszYvJpFf8A/dopUyRobulRVwyYI3PCfQz4W4CjVINGq+adbt1wlWXm4Me+N5uWtfAX8jYskTLFL/GosnuBcP5OHFtYsB/vl4IockY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763764; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=stHVeUHtUkhvr3p0PGGWk2OqvHsyK4X6A5Msa7FZmRI=; b=BFoPljCnB/stVXM/SDZkx168aEv6cpugZGkvbeiYvViY17FnJJyJAH0yEAzkPGTYB2qh6IyC7ytTXpmkIYASgvRMJNlhGyEiZDi15XIgobr9ZMXj9ugzSn6Tw+RiG9b0L7JCFVIpi7jo3GiJAGavTfooPHc1XT/BPfIupKfrhfg= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763764; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=stHVeUHtUkhvr3p0PGGWk2OqvHsyK4X6A5Msa7FZmRI=; b=VAl36DApJa9Ka7FhMUqsOfJ8mhl1uZwUGyrpB8Y4rchcH464w7KnmlBYlE+G0jfp lA7DeQ1pVVaRFK5IjYBsRN6daY2HV9YhPbiYCXwdrwcTo8s+P67bRFw5P7jH8zUTGiM OLmsZfL2hQfTTBEsRSzFR+GLwSjDnndMZMBJ1beA= Received: by mx.zoho.eu with SMTPS id 1773763760862485.8642777649935; Tue, 17 Mar 2026 17:09:20 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 06/15] bootconfig: constify xbc_calc_checksum() data parameter Date: Tue, 17 Mar 2026 16:09:07 +0000 Message-Id: <20260317160916.33576-7-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" xbc_calc_checksum() only reads the data buffer, so mark the parameter as const void * and the internal pointer as const unsigned char *. Signed-off-by: Josh Law --- include/linux/bootconfig.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/bootconfig.h b/include/linux/bootconfig.h index 25df9260d206..23a96c5edcf3 100644 --- a/include/linux/bootconfig.h +++ b/include/linux/bootconfig.h @@ -36,9 +36,9 @@ bool __init cmdline_has_extra_options(void); * The checksum will be used with the BOOTCONFIG_MAGIC and the size for * embedding the bootconfig in the initrd image. */ -static inline __init uint32_t xbc_calc_checksum(void *data, uint32_t size) +static inline __init uint32_t xbc_calc_checksum(const void *data, uint32_t= size) { - unsigned char *p =3D data; + const unsigned char *p =3D data; uint32_t ret =3D 0; =20 while (size--) --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 789722F9D83; Tue, 17 Mar 2026 16:09:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763784; cv=pass; b=ZTziYvYFmqaronSzMPSGxUYMWBG2pkk4MdfMUw/Mt9pEJ47j7E9URvMDgC2sAmKVtM75WGH/gT170j4Vy2CaQqMH3us25DDQA+Hskstoan5Lad2hW9bw4nHH3Pwy5plXL6fafRrYPq6ZlT3of3iuaOfsgYRQCSjHFNWSrqYeSj0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763784; c=relaxed/simple; bh=vGHAAnRSmfkKeoZIkPxL389Ha8SG4InW5EOp9WN4bv4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lhtwBL9K5XDbfNqMvLwZNF+PawUM/81U/zHd799wrdkfLPZjGuGMHRk/HXegH1STfCQWpg/VDy1Uld5vLm5qr/C7cXdUeXLM2BAs+ZnJcOVToFJP/tW/YIgAjhUXoc7HsBM54zRtYz88qOrQ2+yVUr2ZS7cAGet2TtJITIDCBWo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=MC3wxsKy; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="MC3wxsKy" ARC-Seal: i=1; a=rsa-sha256; t=1773763764; cv=none; d=zohomail.eu; s=zohoarc; b=TRK5y9wTTPbfip3sSlEe56nqZtt32xY5IclbRqjqyOQ6Rt3WobnsVExtnClq+JJi08+5xGD9TIXco8c5ZC/+y2uObHmmjUenYIR4VUgUnB7fT++HLbV25Qh7f99TzR74cJRY60EHftROusrEeoXDY+EhgB8BUZJ1QytvVce4RiA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763764; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=45wJib0hzF/G0lzrOyItS1blgCsEV6Gatl0MqE00PSc=; b=MMf2I/DScn+bCxCqJdwMCl2V50HcMI6V2kz2n4SK3RLjn+v0bdlAIAmeqDDPSP8nIrZxf5t6OLqwrqG/gwqjjIM6cEMjuHMdwZWovUImbo1reLd8fv2br4fS/b+of3I1nO4nrIcDQcakXVqJhqSYQTt7zwabH+TE7UduUYaSlF8= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763764; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=45wJib0hzF/G0lzrOyItS1blgCsEV6Gatl0MqE00PSc=; b=MC3wxsKy+h1C+uoo4zVYqS2I78guhgtySvhgo0wKh8oz4HgHAvrQKFAmrxjb8N/5 CZj9CfWQ9tCae6aUZzmQHbpXnQu834/7rs3X7hLb9lpjC96wte6k5VNy0cxU8v7IeYM P6ZoqkK4bD+0yg0aA0eGkTGg6wBWW99uqeqBN0Yg= Received: by mx.zoho.eu with SMTPS id 1773763761395468.1932241623323; Tue, 17 Mar 2026 17:09:21 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 07/15] lib/bootconfig: replace linux/kernel.h with specific includes Date: Tue, 17 Mar 2026 16:09:08 +0000 Message-Id: <20260317160916.33576-8-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" linux/kernel.h is a legacy catch-all header. Replace it with the specific headers actually needed: linux/cache.h for SMP_CACHE_BYTES, linux/compiler.h for unlikely(), and linux/sprintf.h for snprintf(). Signed-off-by: Josh Law --- lib/bootconfig.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/bootconfig.c b/lib/bootconfig.c index 69486bd56fea..d7e2395b7e83 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -17,7 +17,9 @@ #include #include #include -#include +#include +#include +#include #include #include =20 --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 744CE2F744F; Tue, 17 Mar 2026 16:09:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763786; cv=pass; b=CGrmFI7lzr/NPSMRYdaPdGCsn/EvBAu1k4sR76ifBZUYLsRqrVvYMeha0HZd5eHsr9zlwH2Taz2cCO/iWnKWfbAoZrFESTbTVJDbzYTIt4we2oUkabsdQ+K4ZqM/xvK8uOf1NVHEIzQbauP1mNjuuXL4nND9cv2WvnersCxFsD4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763786; c=relaxed/simple; bh=mcfYTARZ9+qwn1715pM8kGZGCcYS4MRg74eXwnmMUjk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ULfllHa6+YnzMbOGkpzP9JSkK/a1siS01hv0MEYquQDzRDQwsvZUhGxNDIC5IS9jNScO7UBCLRFbq4AjWjjf2KmUFIYGVy1UvtmsCM/xO3Ib06YfVHWdBOdh6sh8D/icHfrsR4SgAGxnQMaQz+vy8P6Q68R9cf20tVhum4gPZvI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=cNTc5q1O; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="cNTc5q1O" ARC-Seal: i=1; a=rsa-sha256; t=1773763763; cv=none; d=zohomail.eu; s=zohoarc; b=Z5ahiPTB95FaY4IkOFaBY9YpGB6R+RI0u4FQNr0TrbD3lVpZFMzWWcNFZEVBTkYZ5n0WtPhM5fyI1baCMPwvDY9ABHt+5E5BNJoZk2f7ytKdLsjSugC+xR5c1IRC9wqFNXM/iUjLuYh5VhNTlNcf2N97fU4nRvnDSQn459Ta5p0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763763; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=xdisry/4Zni34uBuoGLJlIlObU1XusIYMD8aJlTO/98=; b=BCW9m+griJetR8LR/l4yGGIJejr3wW1dFUWrPfq0zsGUxiZa587vIHwKQbySIgFfS6aPl+y59HN/CW9GLSN1TLMwQuTtycHVszkKDAbnBaOQY585UoZF3a2nAMwP3XIFzpGYpIwccc9Vvlje7IfOJfDgW7mRsUbfmIILI93ONP0= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763763; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=xdisry/4Zni34uBuoGLJlIlObU1XusIYMD8aJlTO/98=; b=cNTc5q1OdOUJ5uEV/OuELe1CkN3pisbP8tcxzErsPF1km+hE2JRqO+nrh8FRuuGY Y3KccmOi7FcYq/vSAmulYNXxOkGWRMWRcccYiZli7f3jGIszr9gb84l5BY0oaaBhSSD vuzBMTeurYQbgMb08UIIGLoQCHBuTCO54/Jk9V0A= Received: by mx.zoho.eu with SMTPS id 1773763761911215.23154651182222; Tue, 17 Mar 2026 17:09:21 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 08/15] lib/bootconfig: validate child node index in xbc_verify_tree() Date: Tue, 17 Mar 2026 16:09:09 +0000 Message-Id: <20260317160916.33576-9-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" xbc_verify_tree() validates that each node's next index is within bounds, but does not check the child index. Add the same bounds check for the child field. Without this check, a corrupt bootconfig that passes next-index validation could still trigger an out-of-bounds memory access via an invalid child index when xbc_node_get_child() is called during tree traversal at boot time. Signed-off-by: Josh Law --- lib/bootconfig.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/bootconfig.c b/lib/bootconfig.c index d7e2395b7e83..1adf592cc038 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -823,6 +823,10 @@ static int __init xbc_verify_tree(void) return xbc_parse_error("No closing brace", xbc_node_get_data(xbc_nodes + i)); } + if (xbc_nodes[i].child >=3D xbc_node_num) { + return xbc_parse_error("Broken child node", + xbc_node_get_data(xbc_nodes + i)); + } } =20 /* Key tree limitation check */ --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63523305045; Tue, 17 Mar 2026 16:09:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763787; cv=pass; b=kRT463UglhYe6MKFCdsPZovqWPFnOOfGTpWNhfiNM7Gmp5CyWYBDlJCf+HP6AGF8maItOeXffUttVcf2nhln4o/DkIyvyoJ1g7WtGf8wEuP+HTrHN89Bns9HeavbzClF91dAO/VpXnAjmH4FMkTgM8WdpvgJbjpLMNf+8c5bJeE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763787; c=relaxed/simple; bh=/HTM1vkxBM9SoKrz6RIYt2QFZ7EuH4iZflenAbS4ZAo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=f8JGdDuvx7tVjICBpKx0oVtCBxvbxOj1U38V20MbWuHfw1iUggvBGmbP+yhSIVr1BeT3bn02DtqBL9SYQNQrCy6GbHnGrLt4QgtRu5uaMi9axSsmrtimAC9UP5Ge1yUjX1HihGFTpo40hQy8rZIGdmmyJf7z0Xf1ed42OzNehXQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=fmei6//r; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="fmei6//r" ARC-Seal: i=1; a=rsa-sha256; t=1773763763; cv=none; d=zohomail.eu; s=zohoarc; b=CPGG6f0pbDJfnuAUGsguUV8zjEzgZV9BIiZI7IFzIc0OXL/r95WjcAfjgWHULwTCkPK57fsDr+50KcyjoESwO/k3nxKwzK1BzMpnbPvBzxtgdNKHkru4fViyTFKI5K39dgODlG+cUTUhHZ8XM8K+4g87NHECR6Xeo8FMZbKuJn8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763763; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=wQFyRPqlyhXtP7Cik8jB5wy9RJRVH73G8I3fT158msE=; b=f7eOmkxhMZhSTJwICWfMWxXB9GBguSAc4CcSFi9ZmcrBzCWHZP/+xh354fYz4vilAUdcZRLPJZzjpz4CUujMB8n4Zly1BAngtUve2+pe2hyLix70IgH262Zmwfg9UcutXEMcTf5oSPWlkjPz4hjWVK/bsnuu5wLM1D3j7NWhlZE= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763763; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=wQFyRPqlyhXtP7Cik8jB5wy9RJRVH73G8I3fT158msE=; b=fmei6//r6+802cKDMMILYo9vfPVfF1jQvjCP2XkFXDJGDjymAc95ANhdDUzHCe7m pxv5Fug8o7tKWJ4amrSN+sz/EDdX8A/NGL2yfsBOkbQ5PQy/Su54niZpjXuvZUa3uv3 DdB9Zl9utBoxmdjIM8SVoMYmBYp2jjszOL5oeqTg= Received: by mx.zoho.eu with SMTPS id 1773763762454516.8758136211599; Tue, 17 Mar 2026 17:09:22 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 09/15] lib/bootconfig: check xbc_init_node() return in override path Date: Tue, 17 Mar 2026 16:09:10 +0000 Message-Id: <20260317160916.33576-10-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" The ':=3D' override path in xbc_parse_kv() calls xbc_init_node() to re-initialize an existing value node but does not check the return value. If xbc_init_node() fails (data offset out of range), parsing silently continues with stale node data. Add the missing error check to match the xbc_add_node() call path which already checks for failure. In practice, a bootconfig using ':=3D' to override a value near the 32KB data limit could silently retain the old value, meaning a security-relevant boot parameter override (e.g., a trace filter or debug setting) would not take effect as intended. Fixes: e5efaeb8a8f5 ("bootconfig: Support mixing a value and subkeys under = a key") Signed-off-by: Josh Law --- lib/bootconfig.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/bootconfig.c b/lib/bootconfig.c index 1adf592cc038..ecc4e8d93547 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -728,7 +728,8 @@ static int __init xbc_parse_kv(char **k, char *v, int o= p) if (op =3D=3D ':') { unsigned short nidx =3D child->next; =20 - xbc_init_node(child, v, XBC_VALUE); + if (xbc_init_node(child, v, XBC_VALUE) < 0) + return xbc_parse_error("Failed to override value", v); child->next =3D nidx; /* keep subkeys */ goto array; } --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DECF82DA769; Tue, 17 Mar 2026 16:09:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763783; cv=pass; b=KeVtRcNbTrcU1gyk+/BP2aHSQdmHuB23mqerNCEiIQ4pOeC+KIP0jWc3z1anZuIIvBVTIib6e2Ibm8hFbb7+aR0XYH05zwlhA8J5GZnoUhZSOiDArSTZmv6S/70HCjGdp07WSL276d9G4tHh1nButydgCf01bgueFhFtirs5sC4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763783; c=relaxed/simple; bh=1d2TzSzyIPMrAlnmm/L3w5ldSBuILvytBNaGCNG8nEk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IzMpYnFzTqz2IWRxpTi48WfrgCT3+zT8xIke3RwWHZnIoZBWCWBluE6l9/rfp1muHUIeTeT/ONw8gXA+dvGQyzx0QKSVlZErF+0Gm3w8Bo88pNqSii2w4SZc2KYQJrM+okyOLTiqW0EHYwX6cp5Xy/y4/Za5MkYDpin21otzwA0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=JUJ4HRtm; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="JUJ4HRtm" ARC-Seal: i=1; a=rsa-sha256; t=1773763766; cv=none; d=zohomail.eu; s=zohoarc; b=PLXLcGElZ7TOZU8IuZOL6zj8AmISxQ1SNO16gvGJE9qKa1oUyjf1Zac4Uca0ma1aw2JyoACdFV3t4ZUhC3iq+1xEWZ4uiKEFmyUVVR/jtYkNcQ8Y0nHOy2QSzeodeRPCPUo8OfFX7fibkYNBbXT7y0oPmNZAilnJkU/JE3llcZo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763766; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=nG+a8XwxykTG22ppFE4Xm1p8EJcF589vrbNMwy0/cPg=; b=Nq7zrsTNhe2mj8p8wDYvMF/dqz44bEMf+bkFHQVBN6gLV+5WkoB5qb03p9YDJsH62oj/wIC8umsp0o5h0aIjiu2W23iX//CuUTpKPNBTca6KmzFAUE+D/gneHsigGdQI+Pr4T/QLUMieE9dxD958oaW2cqhatzX0LeHlO3/Hzo4= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763766; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=nG+a8XwxykTG22ppFE4Xm1p8EJcF589vrbNMwy0/cPg=; b=JUJ4HRtmNghVmS34bLhcs75Yp799lwnl74c4XRLtNdMcNUUUnklJVTl13w2yUHHc jRpJj3dg7i5kYJZD7pfDdjQKhO9nLXlX5V7WwVxaFcgyBXKwG9JRMli0tQWHnUF1bVN lKv822npo6YvhD0woq/IAr9DLkxasH3SEjT4HCkc= Received: by mx.zoho.eu with SMTPS id 1773763762975503.8071820235392; Tue, 17 Mar 2026 17:09:22 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 10/15] tools/bootconfig: fix fd leak in load_xbc_file() on fstat failure Date: Tue, 17 Mar 2026 16:09:11 +0000 Message-Id: <20260317160916.33576-11-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" If fstat() fails after open() succeeds, the function returns without closing the file descriptor. Also preserve errno across close(), since close() may overwrite it before the error is returned. Fixes: 950313ebf79c ("tools: bootconfig: Add bootconfig command") Signed-off-by: Josh Law --- tools/bootconfig/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c index 55d59ed507d5..643f707b8f1d 100644 --- a/tools/bootconfig/main.c +++ b/tools/bootconfig/main.c @@ -162,8 +162,11 @@ static int load_xbc_file(const char *path, char **buf) if (fd < 0) return -errno; ret =3D fstat(fd, &stat); - if (ret < 0) - return -errno; + if (ret < 0) { + ret =3D -errno; + close(fd); + return ret; + } =20 ret =3D load_xbc_fd(fd, buf, stat.st_size); =20 --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DED7E2F2619; Tue, 17 Mar 2026 16:09:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763782; cv=pass; b=pLhtL4PPBkbo1jE3jKIF3p4vtYGXbaEjvBfl9Xvwiv14m5eySMqu7H1koLcV4P54inT+sz62Em1d7LeZjUiLzBjXpm8z4KHOXMS/MbKpOpQts7sszr28CBqmsTc1GztEuvSX8olxwm6SKBabfx/jXD9JLu9FwJWLeRLfbgjl+7U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763782; c=relaxed/simple; bh=k1J7BK/fpcNNRsuYpLDEr6NUfHMMBv470GcUJe6c/Bk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kNVHcQ1rBCMslBbGl7pj/iMNjZ9IBRjH79dfHybFziWn5jeoVYW3RUV2j7fkQ3+49OocvqTFJiLe0WgcFoQBEbQuuGna7Ub6rjgK6PdlKsgdU9xHoYxeUzlXemunl6Qo+xREtSva5/ukf5niCaO3Feff0MJZh/6kBatrhbVyWU8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=LqTH1jyT; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="LqTH1jyT" ARC-Seal: i=1; a=rsa-sha256; t=1773763766; cv=none; d=zohomail.eu; s=zohoarc; b=OtWJCTHrN1V7VY4785ZA7jriMHvlIS1KEOl0AHuiqu5X/goGIZUnfN08J17HxIQUoTBizdpbOb6MKVaGzXW31J96zCgjZnKP4h4hBiF+axyotHyDcubCwJ/oAzy4hcoY3XtyFJn89jF3zVxYISzPpGjkex7gh4gq8XmD/Q0KDJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763766; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=EX/3umGvgoplaVSbNUVqsuFtykwhUNbV9tqaQFKaobM=; b=amUZvv2twEXIuRrEzs0jfKc1d0SfGmZxa+J79QgsUgvz1yJGDDjoBpIfQ7NabxV64WZirQtBjo8l4xjK64Jm8WbcRMgbIOe9oe/tNF53EisPKDLZFyd9wjVPjg4DjDDI0nracuscYbB7b2A9B7LHwvPu7WIVO4qKmNWc7xrt8Cc= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763766; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=EX/3umGvgoplaVSbNUVqsuFtykwhUNbV9tqaQFKaobM=; b=LqTH1jyTOPcVBy6fa7V2BGufAo/YTmdhZAh4wyTtU2KmgAd8Wx/SjaM1gUJDK4h+ NJHzomtnDW9HVU5HdjhPsd4j+KxEi3XWM8nKKOKbXiPo26KWwuI3wQ/HrhJb94i+DUm ITEdnb5Z/UkKbbZ/ylUzQ9m6A0SqxAwHMXnKLK3I= Received: by mx.zoho.eu with SMTPS id 1773763763492148.96351708589395; Tue, 17 Mar 2026 17:09:23 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 11/15] lib/bootconfig: fix signed comparison in xbc_node_get_data() Date: Tue, 17 Mar 2026 16:09:12 +0000 Message-Id: <20260317160916.33576-12-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" lib/bootconfig.c:188:28: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' [-Wsign-compare] The local variable 'offset' is declared as int, but xbc_data_size is size_t. Change the type to size_t to match and eliminate the warning. Signed-off-by: Josh Law --- lib/bootconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootconfig.c b/lib/bootconfig.c index ecc4e8d93547..dd639046912c 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -183,7 +183,7 @@ struct xbc_node * __init xbc_node_get_next(struct xbc_n= ode *node) */ const char * __init xbc_node_get_data(struct xbc_node *node) { - int offset =3D node->data & ~XBC_VALUE; + size_t offset =3D node->data & ~XBC_VALUE; =20 if (WARN_ON(offset >=3D xbc_data_size)) return NULL; --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9B7212B94; Tue, 17 Mar 2026 16:09:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763781; cv=pass; b=nOvMgKWJJ4XnMeD22hbVthrfkaG2DEEFwM7l/V0p8r9sc9yPyMz35Z4so6nVtT95UJX7wanbsrGuaYKv4M6pcoA9cDXVz49hvAqUF7UYSr6Hp7Jqx5Et663BcHCHaeaRDYPYrpzmuIfeuUm3Hc2zGklVv/enG/619Hu+Q3z9Op4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763781; c=relaxed/simple; bh=5DrGSXMEeIUOEdbJ9WiMaf2PnGRbNPGketohz92imfY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RytWsj9mf2pDvDQvoYR8NtjUEIUALRgynyeOscSUUvqTNfxh3YgJsFtxmr590WWKhE7eRL0PW7nMtoMKxwXQ1DaAVvGzQ+7h+OhfkwqmQLNAGzxZBVLmvTcSvfy0CB03iWZhX8THUShGLhhTioh1osK++YkWFo+u10SctKj7yDY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=ieSRB2gr; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="ieSRB2gr" ARC-Seal: i=1; a=rsa-sha256; t=1773763766; cv=none; d=zohomail.eu; s=zohoarc; b=kBavarqmOAbpMRVYZ9t7UM9v/eLaGFP8K15FyyXt3zvs/AWBJ1Fvt2d0AC/Z/nnGCwsOw32xmTL0JqVjn4qP2afv0j3INDoVP2BgK/79jlBwZ+n+Hlo0j2JT9rqSyzoI/kZpcIlW+6T8no43yDysKJ7YFsW+We4I+iA+Fs5nByI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763766; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=3izM0F1cOHEJuEmqlhbjziddkmwLfk1V+4E7AazdxMQ=; b=AXLiDdMIh1I4o+yuJ8HH+E5mkZ6GmeK9B6f9Gxez4ywoRTUhAIeaDHz++MaFo8JVh4QDi7/1a+Q5ygGKvHx3WkJp1GB3ioGuYANA+gTISIqi73tzeKfB38rkbtF2BqUv85JrzV8eAqf3CwFfnCKwjS47a5EVw6JFqVLU3igbKQI= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763765; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=3izM0F1cOHEJuEmqlhbjziddkmwLfk1V+4E7AazdxMQ=; b=ieSRB2gr5hYNEtjlojwgz2ry9h5dxDR9SAoNpto1grKwgjf4htrBUrZ7bOPrYtwF vfZByo+ROuqOlbwsjInyKG+Grme1B5RtTF6MwTlPB+lKwvHETOA+EuswFrbpWybJxzR 00wA6013u8ldMK8otKRQLcRR1U4vrksIlpwNrJ/w= Received: by mx.zoho.eu with SMTPS id 17737637640031020.3670628719038; Tue, 17 Mar 2026 17:09:24 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 12/15] lib/bootconfig: use size_t for strlen result in xbc_node_match_prefix() Date: Tue, 17 Mar 2026 16:09:13 +0000 Message-Id: <20260317160916.33576-13-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" lib/bootconfig.c:198:19: warning: conversion from 'size_t' to 'int' may change value [-Wconversion] lib/bootconfig.c:200:33: warning: conversion to '__kernel_size_t' from 'int' may change the sign of the result [-Wsign-conversion] strlen() returns size_t but the result was stored in an int. The value is then passed back to strncmp() which expects size_t, causing a second sign-conversion warning on the round-trip. Use size_t throughout to match the API types. Signed-off-by: Josh Law --- lib/bootconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootconfig.c b/lib/bootconfig.c index dd639046912c..3c5b6ad32a54 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -195,7 +195,7 @@ static bool __init xbc_node_match_prefix(struct xbc_node *node, const char **prefix) { const char *p =3D xbc_node_get_data(node); - int len =3D strlen(p); + size_t len =3D strlen(p); =20 if (strncmp(*prefix, p, len)) return false; --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEDFD2F39CE; Tue, 17 Mar 2026 16:09:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763782; cv=pass; b=k+/Vnb5+uKqX2LYLpFVHLR1aTjCBfWx580GDpOdwN5WjzkRPfRC/Ba17vlFNyyIAtdvMnHKjNZp0RYnArnk0cWhqrISeFSdvrmx68dTGZ/RME0rXPJduSYPSNMyrb3EZnfiJH9LYgugd9slW9PswOSyAImOe+apgCP4GFaidNS8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763782; c=relaxed/simple; bh=DUCDFOLJ57qkCNI68sXQsO7UVxK28h+iRY+VtUQMUrY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jFjrL8HTsoajAashZ9+I0DjYzQYcDB+bW44NRMmNqottemP0f9K2nYQ8jP4DSaKYJSnU2iqqHTFVxikyWY1+oXAdN+SGBDgN9wMbs+8F0f1eyD1jbqppzhMb8gqxvNZeAeMq2IA8PC24MMqgcO1NvFGN8lWWhc9vyye3MdasLTY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=cHd7JeN7; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="cHd7JeN7" ARC-Seal: i=1; a=rsa-sha256; t=1773763766; cv=none; d=zohomail.eu; s=zohoarc; b=DLJ8SbBrfeT9NAgbgxEQP4/9I9BmftnFk7wxkF6QwQQ0RmJNeiZqwkNVW2lzSGxznmQbdkMcv1C3/y4K8V+h0m4Is+Xf1mdspz6/yOQKHCI9aHLDu4WTwnSztBP4tgjbkecuLMYMlIuCXbWe9pXNwJ2E3z71LWOfx2q7f46Xi5g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763766; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=rp+wuVlETQfmLgKmv7tEFfJBknrCQ1YXaGdK0CbMPg4=; b=YLlxZvXW41MqJmYr8gwVFZYE832QMX1rGMnDpmX0KJVV4lv5Uv0VWxbpb1lb8fAqV6JeKJvvN0dIyvl54t3JkHeMeOuXORMaKfnrXoktrlDl/65ibXz6KkQnL444JKHQwBTXbeL9rajL+12LEW1tDTfTraa1CMh4+/y/s7DysSw= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763766; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=rp+wuVlETQfmLgKmv7tEFfJBknrCQ1YXaGdK0CbMPg4=; b=cHd7JeN7juSuUp17FplRsCsEKSAA84d+vayNymfT2L1ZdIQleeb2mJHmRBwMCVy1 65yXXtBghdmsd8AheHT99LZLOZJLlGtHhtRu1sgtolMH8A6VrR9S8zeyTz6QlUEYCAY sfjI0aKl+jOilTjMUI7NL/FN0r9KJctAyBXVD6VM= Received: by mx.zoho.eu with SMTPS id 177376376451425.03107281800885; Tue, 17 Mar 2026 17:09:24 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 13/15] lib/bootconfig: use signed type for offset in xbc_init_node() Date: Tue, 17 Mar 2026 16:09:14 +0000 Message-Id: <20260317160916.33576-14-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" lib/bootconfig.c:415:32: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion] Pointer subtraction yields ptrdiff_t (signed), which was stored in unsigned long. The original unsigned type implicitly caught a negative offset (data < xbc_data) because the wrapped value would exceed XBC_DATA_MAX. Make this intent explicit by using a signed long and adding an offset < 0 check to the WARN_ON condition. Signed-off-by: Josh Law --- lib/bootconfig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bootconfig.c b/lib/bootconfig.c index 3c5b6ad32a54..119c3d429c1f 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -412,9 +412,9 @@ const char * __init xbc_node_find_next_key_value(struct= xbc_node *root, =20 static int __init xbc_init_node(struct xbc_node *node, char *data, uint16_= t flag) { - unsigned long offset =3D data - xbc_data; + long offset =3D data - xbc_data; =20 - if (WARN_ON(offset >=3D XBC_DATA_MAX)) + if (WARN_ON(offset < 0 || offset >=3D XBC_DATA_MAX)) return -EINVAL; =20 node->data =3D (uint16_t)offset | flag; --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CB902FFF8B; Tue, 17 Mar 2026 16:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763785; cv=pass; b=J+PQFLUbd3ZoJJ2nU/FDIAwx7/gwJK+/Jn0LgKZmlK2NFQcUcNFkrje6ny0HxrzOyrSQ1M0jUw7ujntazjApJo+s7Qx3pmN+/JQFZuK3goPk39RXuuyXnDTFwrcC+8uJdcB+JTj6BPo7hgPCb2pNndmDb+XiScdVGZWqdMEVhUI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763785; c=relaxed/simple; bh=EqMWAUq5/avE1mG8HKfM7kQJ2gUsjJ6VbsxnUKQBLpE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XpjEE//tSeSWQ1ObyuIptZ0t4a8+N6BRoqSqjpyoX71/T/ge09gYAa6yVNIVisUEEZrGtHV909V+qZ+qedLyS8Qeng2sm2PCguGjcZpJY51RB4Masycwc6uwqd0dtfYQ5iW4cEwW0KkqEeJFeCZ30OwS0o6weanI7ZYYPBseTBs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=m0uD7L+h; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="m0uD7L+h" ARC-Seal: i=1; a=rsa-sha256; t=1773763768; cv=none; d=zohomail.eu; s=zohoarc; b=kl9t5cFUdRhcw9oczcFLdfI1wJ12oVDraqbngY3V/VvXGf6P60c890opOul4Nyt5Z7Cn3w0e6MWfih1ZEV9SEMygogj9fWy1DccLZsjVY+gjQTb+E/LkTv6tNqR2RjH9ll/2BKiNDka5VBwjCs6h9vs0gKcyNW+BV0J3uT21lUM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763768; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=e5e02utD/W21D5SULgd/Z0p2eCKtDuMDRU7p34F6Lik=; b=QqhGsgmVSPUr/+4cmRVht6vzHbceZcLUeifuhFTWl2peDC2zY1Ta35mgtSapNGM60zK3HIl2LLkA4S7Fx+Dqhh3G7SYjt6btiSSbGHqb3o4q4nNgYsR8ZJznRhP/B/YV5iupG9nq0Jq4iul3vBg2YDoqbnoaan5fYBHyNaYN8Ts= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763768; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=e5e02utD/W21D5SULgd/Z0p2eCKtDuMDRU7p34F6Lik=; b=m0uD7L+hcrPI3FN1oAA4uuaZquQAax8iknb0B6RHpQEC11H9UAKSRaIeTO0cX0t4 z83gO+cRPEFtMBomZk/7qrffzjqRxcTOapJEjsCInf7nsw0Bfk9mFeRgXUD6xvMTL/V d7xskmynkDZ741/ygyF7t2zDusXA/DRQfExRJAuI= Received: by mx.zoho.eu with SMTPS id 1773763765042341.18896728305253; Tue, 17 Mar 2026 17:09:25 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 14/15] lib/bootconfig: use size_t for key length tracking in xbc_verify_tree() Date: Tue, 17 Mar 2026 16:09:15 +0000 Message-Id: <20260317160916.33576-15-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" lib/bootconfig.c:839:24: warning: conversion from 'size_t' to 'int' may change value [-Wconversion] lib/bootconfig.c:860:32: warning: conversion from 'size_t' to 'int' may change value [-Wconversion] lib/bootconfig.c:860:29: warning: conversion to 'size_t' from 'int' may change the sign of the result [-Wsign-conversion] The key length variables len and wlen accumulate strlen() results but were declared as int, causing truncation and sign-conversion warnings. Change both to size_t to match the strlen() return type and avoid mixed-sign arithmetic. Signed-off-by: Josh Law --- lib/bootconfig.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/bootconfig.c b/lib/bootconfig.c index 119c3d429c1f..272d9427e879 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -803,7 +803,8 @@ static int __init xbc_close_brace(char **k, char *n) =20 static int __init xbc_verify_tree(void) { - int i, depth, len, wlen; + int i, depth; + size_t len, wlen; struct xbc_node *n, *m; =20 /* Brace closing */ --=20 2.34.1 From nobody Mon Apr 6 22:15:24 2026 Received: from sender-of-o55.zoho.eu (sender-of-o55.zoho.eu [136.143.169.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEE752F39D7; Tue, 17 Mar 2026 16:09:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763782; cv=pass; b=qWPC4+BEbcrQsCsfzAm0VyxBGUAm+knQhi29OmUArMrAvBPpxdPWg2B1bUDhHGw2QpWAhbNBy/z2R0Sgk5+ybmzP3KL2CsGauRjSgVmUDfLZn1GkF2a4P6ypBjWczMeSJS+FxarljgghOM547qsPIc3e2e71V7X60qJfstS8WQc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773763782; c=relaxed/simple; bh=7qcTi1Qw1HGoC100WqAdp0msifIJQXAc1FoFoU3K2WI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hUg2OmuIM8GEyjFWDMdGgpY8fFcWM0ia5+rcz1DOZJBkEMrS/eYTe6gG1EuhU+L16U27e3MDJlwZFqaSAG30w17J7wu0kM9hcAmwbpTxRJNIe8Df2cK/WpwgkHZdhxQ4bqXfwzkoB884XDhmnZ53Ii/O57Dh6PSbE0oUggzO+7Q= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=XwtiSIiG; arc=pass smtp.client-ip=136.143.169.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="XwtiSIiG" ARC-Seal: i=1; a=rsa-sha256; t=1773763767; cv=none; d=zohomail.eu; s=zohoarc; b=UFZ9i4mineM8nan9jVZlV9uUfhifTKE4fPVcwHnfeJYmiCjEZA5tci6OS+6fVZJ0RpB2tjuzv4lf11QZDV5+mYeUJsZCsxPxpGIvhm1Ij80w8d+9njPVfS26m/4Sx3q1ZeYBQgoHtGx7QhuLMIgtU9sSoLlpf4UY+0H4XEGow70= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773763767; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=yaW4QSTW/xvXliENDpTM5TzxDHmHb/cNBlikwq/chqo=; b=AvhAuJXxSTbUCivfgzgSxOnD8jag5pFpQjUZFN3tGVcKFP065GK2OHny6B1GWkbHfR/PCvYBicmRqgQKhY+tgNP/miPvfQKiVOMePso4h2i6mDZU0sFhpcco3kk9Mxsi3RmTvuoyQgLYf0s0mf0Woyb+bphr7u3PmGhRO5/A/xQ= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773763767; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=yaW4QSTW/xvXliENDpTM5TzxDHmHb/cNBlikwq/chqo=; b=XwtiSIiGoaSzG5su8Uzc6YsXTDijc775NB/uVYMFZLWbCbdl0WsEercQ7atX9zW2 ksxjHTB2vn2ZAH7ORakBvmdngJUPyt+TBhrvwnA6cika9ghph9jDkN/VBbtulmsNrJO 5EaCEHlZi9QT23PHSJ9rZXNvD1HeIR6bQj6PzhU8= Received: by mx.zoho.eu with SMTPS id 1773763765561822.5473913418199; Tue, 17 Mar 2026 17:09:25 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v7 15/15] lib/bootconfig: change xbc_node_index() return type to uint16_t Date: Tue, 17 Mar 2026 16:09:16 +0000 Message-Id: <20260317160916.33576-16-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317160916.33576-1-objecting@objecting.org> References: <20260317160916.33576-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" lib/bootconfig.c:136:21: warning: conversion from 'long int' to 'int' may change value [-Wconversion] lib/bootconfig.c:308:33: warning: conversion from 'int' to 'uint16_t' may change value [-Wconversion] lib/bootconfig.c:467:37: warning: conversion from 'int' to 'uint16_t' may change value [-Wconversion] lib/bootconfig.c:469:40: warning: conversion from 'int' to 'uint16_t' may change value [-Wconversion] lib/bootconfig.c:472:54: warning: conversion from 'int' to 'uint16_t' may change value [-Wconversion] lib/bootconfig.c:476:45: warning: conversion from 'int' to 'uint16_t' may change value [-Wconversion] xbc_node_index() returns the position of a node in the xbc_nodes array, which has at most XBC_NODE_MAX (8192) entries, well within uint16_t range. Every caller stores the result in a uint16_t field (node->parent, node->child, node->next, or the keys[] array in compose_key_after), so the int return type causes narrowing warnings at all six call sites. Change the return type to uint16_t and add an explicit cast on the pointer subtraction to match the storage width and eliminate the warnings. Signed-off-by: Josh Law --- include/linux/bootconfig.h | 2 +- lib/bootconfig.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/bootconfig.h b/include/linux/bootconfig.h index 23a96c5edcf3..692a5acc2ffc 100644 --- a/include/linux/bootconfig.h +++ b/include/linux/bootconfig.h @@ -66,7 +66,7 @@ struct xbc_node { =20 /* Node tree access raw APIs */ struct xbc_node * __init xbc_root_node(void); -int __init xbc_node_index(struct xbc_node *node); +uint16_t __init xbc_node_index(struct xbc_node *node); struct xbc_node * __init xbc_node_get_parent(struct xbc_node *node); struct xbc_node * __init xbc_node_get_child(struct xbc_node *node); struct xbc_node * __init xbc_node_get_next(struct xbc_node *node); diff --git a/lib/bootconfig.c b/lib/bootconfig.c index 272d9427e879..57f07e33868e 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -131,9 +131,9 @@ struct xbc_node * __init xbc_root_node(void) * * Return the index number of @node in XBC node list. */ -int __init xbc_node_index(struct xbc_node *node) +uint16_t __init xbc_node_index(struct xbc_node *node) { - return node - &xbc_nodes[0]; + return (uint16_t)(node - &xbc_nodes[0]); } =20 /** --=20 2.34.1