From nobody Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 2EE9A1F471F; Sun, 15 Mar 2026 12:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577230; cv=pass; b=khQMDeWhzI56jFgCXXWfmPhABbuosGh91VOYJSPpk2xXYChpniZV0DJtpMWXPGTJ+dtK2pp34FEe8dtuzt+yu5xZ9bSpnwpItPQyuE5JL7vLXkvk6bZzJdKCqURbsi1rN3a15FTL0b6630TR1OI5YM7WjnczeVnHgKQEk0i/MY4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577230; c=relaxed/simple; bh=Y9mfWQWziz20z1wZlyGCqiydfBbJQNFNO/oywEYrkow=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ilAaS71JjbCRcrJ7qam+urhAi76YSiv2IQF7ATIZV6EN3pweqiijxR0TUjs+EqFEKWj6GmCVYT81JHjKw6iK9qSRE1o5+sqGwGAY4fiHUxMqJfdWf4CwwXkS/BxQKAiYFBXvQkR6ldtEpSY3QccFVlqnNS9p+BdLGZAn/LK2WvA= 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=b/B3bKJ5; arc=pass smtp.client-ip=136.143.169.57 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="b/B3bKJ5" ARC-Seal: i=1; a=rsa-sha256; t=1773577220; cv=none; d=zohomail.eu; s=zohoarc; b=bF31zOarh15tM8Qt2y6/iTdjSjFrfXVQ+L3n2Ch6lUiyLrl4rYnaQzTv7ai7mfL2IH+JPzJJZIs889raOWxfUt2KfIft9cIt8mgFhbVZ8o+k9HV6q6FSnf4fbJS7uHbSkSVsMLfluEp1gMkGsC83VRM/cB9oNoWmqQ/c/ww642U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577220; 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=hXgtMivk2FUkBDZ0ELim05yAd6enb/8iaNS3/idzO40=; b=GJNAtDv2pYOJdGxhU7oVcDAJNxlNU+I4APQWmlERcbTuVPbafA/6To16GHPuJA0jznEJHWeAzC+OU0t2kzw8T+c9FStuOAhBM5PppPsIeiNu7pSH+YYKRK+OGtsfftyhHtjLSzJKX+kJ+cHWGFUowUg0TwJqSIosO7vD5OIQC0g= 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=1773577220; 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=hXgtMivk2FUkBDZ0ELim05yAd6enb/8iaNS3/idzO40=; b=b/B3bKJ50hUp8gTfMgaZrqX8LuKFRcvSidOFCv2ZmEssYGlFn6IP5ONMT5ot+04Q YntrImmDe+J0dQ1CPluZzQ3rdXEhjbgjhXKGXaHHf2PiKvPZCoTPQZhYJckOSL0TDXl HPXDkNq85Hg5VKvSGXaP+QJdMnd8z8sOHodPQmGk= Received: by mx.zoho.eu with SMTPS id 177357721736357.63884775573274; Sun, 15 Mar 2026 13:20:17 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v6 01/17] lib/bootconfig: add missing __init annotations to static helpers Date: Sun, 15 Mar 2026 12:19:59 +0000 Message-Id: <20260315122015.55965-2-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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" skip_comment() and skip_spaces_until_newline() are static functions called exclusively from __init code paths but lack the __init annotation themselves. Add it so their memory can be reclaimed after init. 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 b0ef1e74e98a..51fd2299ec0f 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -509,7 +509,7 @@ static inline __init bool xbc_valid_keyword(char *key) return *key =3D=3D '\0'; } =20 -static char *skip_comment(char *p) +static char __init *skip_comment(char *p) { char *ret; =20 @@ -522,7 +522,7 @@ static char *skip_comment(char *p) return ret; } =20 -static char *skip_spaces_until_newline(char *p) +static char __init *skip_spaces_until_newline(char *p) { while (isspace(*p) && *p !=3D '\n') p++; --=20 2.34.1 From nobody Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 1ADA933A00C; Sun, 15 Mar 2026 12:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577231; cv=pass; b=gWdaM4fOQQb4sLkDPhGq0jen2R1S7o9kboSHlmJCz7g7tGr4wO/O3ayu/jKAQPT6FSft7MU5TiJJDjkHksS53hppeJuDRen3bZMU/WvvC4+P2cY28NZbDuSe8hBKwpIh4q956JWQjAczEAYOc0P4Dz396pa9e0YSMwwXAAGJnO4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577231; c=relaxed/simple; bh=iCD2JlpB8ag31CBi7R2mYEDIs4sJmCdNKOcmF7gEfVE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=J0HpORH9+HBWwFfKRqORPeeUJMz5SG5IkXAYGUCZNBWB9QJIZ0Yjt2kN7VP4PZyKEYn4nBm0PIFUtVdVP/FGHPP+taKGj7hxvsj+AhL+W5TXQHNgcAvbkr3oWqirUdZM7Tkl0bzFv3l+1cR1BJl/pZovt+y9dIUCjtZyeD5DvG8= 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=H467i46h; arc=pass smtp.client-ip=136.143.169.57 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="H467i46h" ARC-Seal: i=1; a=rsa-sha256; t=1773577220; cv=none; d=zohomail.eu; s=zohoarc; b=jymvZzXoDyEZTdloEGwHDQdkJHYU2Tap0aRZfdTZTZCx2wWsAgHj9KmSMoOnVyt+MwYdFU9gcixrE8ZWBW7WplleKAyP24CfnW5NNMCKQ9//O5pczbIyDA+IHF66T1i6FFxdTK/KogvikTT6E09d8cmo0rj5KGKADT8gT8XaG6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577220; 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=G6uh6iZrfksZ3Z2lXH4oYMyen9srxA5Ump6/qHwxPjo=; b=JTSq6N/+n5bKFh9G3DTf0sSF79KqLZms01YLtigKsjHYSCNprSTC8dFBlTtHuif4rAwpgLGaO0xEZxxRA8uKvhTRo+jR1V/CJEgWVPSGnPMtEBzeO3xx1g6kasRQkvR2fFXA89JbjWf+9xhKehFl2457XwTo8EeHGsTt5150c9c= 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=1773577220; 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=G6uh6iZrfksZ3Z2lXH4oYMyen9srxA5Ump6/qHwxPjo=; b=H467i46hLkCglMWSD/bVTmWHqXSNnWOStm1Zp/BEiVqjlq7IuF/b8cJgb/qvx+WT iIKQuFlj3DdLp1B0RKwFUzmDBwktGyWI40cg7SysXD9jkGdQc40XYJ1dHmxJa5LTtW6 XHP7df/ufHdZk6stwXJRNeQbh+ioZGxkC0nZBeNE= Received: by mx.zoho.eu with SMTPS id 1773577217926274.76406481822164; Sun, 15 Mar 2026 13:20:17 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v6 02/17] lib/bootconfig: fix typos, kerneldoc, and inconsistent if/else bracing Date: Sun, 15 Mar 2026 12:20:00 +0000 Message-Id: <20260315122015.55965-3-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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" Fix comment typos ("initiized" -> "initialized" in xbc_root_node(), "uder" -> "under" in xbc_node_find_next_leaf()), add a missing blank line before the xbc_get_info() kerneldoc block, and add braces to if/else blocks where one branch uses braces but the other does not, per coding-style section 3.1. 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 51fd2299ec0f..80de9540245d 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 Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 E3B66338595; Sun, 15 Mar 2026 12:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577230; cv=pass; b=GPcYIeyf38PmD2ihofCPnZutOTsWa/iW2rafbKB5dKLm56hBrx5Teukzs+iB4WwAi9phVuBg65ik3vTLIhKZxL1BHR+ZNX2nUNQf/uTM1w+E2kVUFmG05fLrEj2RWRvUSlJjDnlnFXlh3oT6GQ5HPulD9vlmnk1mU/NtP/jJEbk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577230; c=relaxed/simple; bh=a+WFwpw+I4XZGC5elagyWWAPMbI+AfKvHrTYWpm5LbU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fTvhKSOBq19xu18R+SYBDyvHK/LOPMWozhkkiJyZj9uBRkauEAPNqROEH4xNznFy8P2I7sSnv8xfm6dcjT3hwnO9Ey4oJj62jurKnrOFArIFAX5ZIQjl9Kakff/5ZctRXnv7SAqCTU80O9HyWt0f1LaU/oIvvuaIfxGVvr3pGSE= 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=gnLe6KhF; arc=pass smtp.client-ip=136.143.169.57 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="gnLe6KhF" ARC-Seal: i=1; a=rsa-sha256; t=1773577220; cv=none; d=zohomail.eu; s=zohoarc; b=IFlXUlf/YPSKxb9abgX56nimkIGsLa8QVB2pOnKQKfZaAVkLnnyzHpfuyvLc5L+aRSk6josZnz2AEWEZwAmtUhvUYeb6QJuDs7EK067pSbScHsT61QXV0i7LOVCIPdYQqt3ojiOsqZVjtWBe7GQTVAyA56xuP7mjxp01zoN4w5s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577220; 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=Ml1F7UA76fJe9dugLYEUHOcRjtxkVNciYSA20s/4dA8=; b=Ps+ukiZfL9h41WjjUicgeirCGaYWQcyJLboKAHqVG9hv0lt+M4R3rT4iKE3hpCFm1R5XhyzXRDPzrmwOBlYONc4+6Ez8ABffJ4cl3fGGvinonDyV7aq6oJL6h1r0DcnwfDmEjrVVbCeGJ0LeWGtSnGrDaWrDXS6N30Ymgcj8mfU= 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=1773577220; 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=Ml1F7UA76fJe9dugLYEUHOcRjtxkVNciYSA20s/4dA8=; b=gnLe6KhFrDpBKrpFyrKhJS7nroFLLMe4YJQIhbOE7hEmvn24M85CRLUAmqZWnEuA hTNDIyuwkbhEzCd9JTqUjCx4NGD17m6HaQZuCycc1F44UESaqu4KB9gFX+9Mvisia60 bfdy5f5WT97+44jV7v/w3wepvpKfyR8Mke8rJq8w= Received: by mx.zoho.eu with SMTPS id 1773577218485880.9295205333123; Sun, 15 Mar 2026 13:20: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, Josh Law Subject: [PATCH v6 03/17] lib/bootconfig: narrow flag parameter type from uint32_t to uint16_t Date: Sun, 15 Mar 2026 12:20:01 +0000 Message-Id: <20260315122015.55965-4-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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 80de9540245d..58d6ae297280 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 Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 1AE4133B6C2; Sun, 15 Mar 2026 12:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577230; cv=pass; b=ShLng6Nojc7d4lOgLt+/9wglBG4Wg3kVBK6qJbsRzXtrUagzi4odP+x6iCa7g0OC9bfWqR0fQ99gDUE6dETqOCUSdVBVCgW/ZgKHKtf8EfMU9l0QLCTSEK0kUg+5e7b2aY4ezoRFtThAvJEB8a8NWMf+iU2JxHg3GiL0dD27ig8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577230; c=relaxed/simple; bh=Tcy477qCr4zjwSxEbmUVpzCk/GlV5mimINv1mxGanLY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fC+IF8BQml/Wz8EdJEf/LMTbQeaDIvpH5UI0tWgk9lZanqf5VeH1O+IeroqmuAmdAN/74xXPP8ruSsVhppeVRiwqQ3IgJfEOmI+OqndUbK/Nt/fNnkE7P7FNMh4kmSuhJyW6Kmm/s1A2h+W0BPKtuD28wYQu4ipE2CycVE0n2MU= 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=fy9nxf60; arc=pass smtp.client-ip=136.143.169.57 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="fy9nxf60" ARC-Seal: i=1; a=rsa-sha256; t=1773577220; cv=none; d=zohomail.eu; s=zohoarc; b=AwnnNU3lP+QNx1SgpLdIB1riTS2b+b4HCZz/1zvofzzyyBa44OW1Au2Q30rOql81NR12jlNQebgy2URedGrp4/zAwO/XhdbEe8ImI2tOg23ga/JUj6p+B9DR07KnbCHfbtgZRbnr7HpvTc//fTJ/wT9i2EePtekAzaFToXufC2o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577220; 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=6J4Zdammh5fpr6R0/8dSlFL0Tel9zMDt6j0TaDyyePc=; b=bD4SM28mXjfgPxFohgvPnnWGBiwjjHjyVDEwg8E5qkSd/wxg9p6QZhgHvkDnjnw9aq4E7qPDvJm0EL0xwMK+b84tyop+HtFkb5xVctkjHmxqCWpZYuKG2ypaR/bLWfnjzKWAoOtSV6QxKad9YoiMWqSeli+saNYF5Jjqtf3EGQE= 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=1773577220; 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=6J4Zdammh5fpr6R0/8dSlFL0Tel9zMDt6j0TaDyyePc=; b=fy9nxf6079BY1LHNowWk0zsVIwi0hJRJ8RaEtU3/OM1jSEr/rVlZwHqE7U4gThZl fS85mvLHOGtGhI9AVD+HHdBCWk7WE48QsejTi9+N7r4I+N58kYuma3KgzJ6iOy4O8Hv a4Xxmr21m+UgNLkh9O9q3EVVJ3UgcJVlpRCB94Sw= Received: by mx.zoho.eu with SMTPS id 1773577219047692.3955522801289; Sun, 15 Mar 2026 13:20: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, Josh Law Subject: [PATCH v6 04/17] lib/bootconfig: fix off-by-one in xbc_verify_tree() next node check Date: Sun, 15 Mar 2026 12:20:02 +0000 Message-Id: <20260315122015.55965-5-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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 58d6ae297280..56fbedc9e725 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 Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 2245634DB4F; Sun, 15 Mar 2026 12:20:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577231; cv=pass; b=QPPaW42IPvvkvNJmH08K8O+swgm6VJz1JWVM3UPg/pjyVQGVXN9qL9F6qowACYrOlsfTYJN3CfSctws7yxjqA5Z1Xkb7MJ9/PpeFiJkYOX3zh5YdRwteMYjock8Y7f2pUEQhyjff744Rl9sxHJRliMoiG++PAlSjumx7/WJ8Tn4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577231; c=relaxed/simple; bh=43QmyCqjwfaH2eT1ZEPKdFGorS2/96CvQZYCl5EDh84=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rYIkLPA6AZHl9Y0uQhbru+tAdmgscyyTXOJRt6NGzafhgurARN8eBuZnkM2xOUJ19NpT30co+C6us3WjfddjTpBNUVzFgKAeg0gTgexZ9oH22c9xgBGtNe7eO09dU3iTy/stYqfQVptI0kzpdHDBigOrDPgeFDk+sE96V0dTwP8= 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=l1yygZ5T; arc=pass smtp.client-ip=136.143.169.57 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="l1yygZ5T" ARC-Seal: i=1; a=rsa-sha256; t=1773577222; cv=none; d=zohomail.eu; s=zohoarc; b=R+rSJBAhZ6S6x5nKVFHgllzahlcyKeR+CiqjKT4VgO2Oe+PpAY4IXTgS7tw8p7bvlL63RgMkqG3PmciQBd3btW7QlVPEqXSTAVTeh26dAzt35YQ+Ktyq05NZRzshVG4oOLLREk0M40UXCPjy3fgfewDWd7/RCCh6j/7LG0vvN9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577222; 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=aQ2JC6gJsIOnVLrttsYiOD8t7/HU2uNkLIv1633cFHI=; b=C6Zs+uvQ3nhbYKbAVSpnIs/p1lTBwzeF01PR5zD/k9NRmFMXS8Tg/TMwi1YiFEOK941ru/gOEwEe+PQi+S9c33DtXAeVghBZfbfcGTluwHvVvuy61FhXHwXsE9TSLXNlDQZWID5LNEkgE83my57Lxq+1LFOzwnJbYUWHCVVtDXM= 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=1773577222; 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=aQ2JC6gJsIOnVLrttsYiOD8t7/HU2uNkLIv1633cFHI=; b=l1yygZ5TczN7QUFWC9iTgQuOJ0iw+fAOimZ3Kh+bZzwaRxbnJyPbR0hhIwgckkyw Mf+HhDi7A9v/qMIsj1ca38YKm8OUMYdedYVYE3ZpDSmWCejJdszR1Gl8zQnNUObu3mD EUX2tLv8IQgj2D1g/XGlmupUqsOhBieuYA79WuHw= Received: by mx.zoho.eu with SMTPS id 1773577219715212.45021646479506; Sun, 15 Mar 2026 13:20: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, Josh Law Subject: [PATCH v6 05/17] lib/bootconfig: increment xbc_node_num after node init succeeds Date: Sun, 15 Mar 2026 12:20:03 +0000 Message-Id: <20260315122015.55965-6-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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 56fbedc9e725..06e8a79ab472 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 Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 2EF3434FF59; Sun, 15 Mar 2026 12:20:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577234; cv=pass; b=rSicpuKNlY75JrTQeU0CzAcbenpvBt90VcC9PqC9IL4ZqkktNjyiIhsD5ANsyGUnUNSuPxnVI1vadrIuE0vulsgeTFMKvmClhkJFcAIa+3KrbNrEN5XpTNBvAYt+OWP4hFjuZiC6BN3pGAZFyyXtRqO/4YqU6rGxPKNhPuxW36I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577234; c=relaxed/simple; bh=EWCRpZBNHCZU8iztguL/vt47WImiwDpV31hec4mL7Lw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F/AqemLVXcCMW2MERFb6rMV5y57/9anQtreRkZcxK4rIgPpXskwDe5fzDjJ3KarOHz+AW8UM22im4qNeh2ugWiiIJQIBJnoBWp71wKCBN7rBqY12KAmFvnajjLlTiZJyMPl4uct7E0azuw0OqhjYFxsZvBmWhUqSe98q9IYzkj8= 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=fRFH3YZj; arc=pass smtp.client-ip=136.143.169.57 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="fRFH3YZj" ARC-Seal: i=1; a=rsa-sha256; t=1773577224; cv=none; d=zohomail.eu; s=zohoarc; b=UqS8DO54HyUvGycrHc12thIIVl2mjaOmKUtLVsXj307dYwk6fJMhVoCbkYFWpBPISm6SPuMPhIyh1tMRCZ5bItSYeOBMveqTN52WkCZ/9mSB6d/jOylX3sdni6F1BZQNEfeZ5wEW2TIEYVqEDKvWh8VfjZUZIWe06GrLrM43qyM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577224; 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=Y3g/gWcuZygcqvX4QpGo9gnBChjnwRu7NCitJ/yvsXM=; b=ksCHEOWFZr0+QqMugMvuq532ivzKH54VWKdxHHfCsG+3kGmXATLI1M6cAo1CtV/PDAZb8S3MN8p2wi0SGpH6AP8l++fh4OCXp+l37uvyeseq1ZJTcZpkRlqb4AdMQiozmwdYRHd/nufhpVnUjXGD9q2nAY+pCnCI2wnVO+MpEfs= 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=1773577224; 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=Y3g/gWcuZygcqvX4QpGo9gnBChjnwRu7NCitJ/yvsXM=; b=fRFH3YZjR5eIU5bQk2H+R6lGA8/Cb6fHTmou5oEJrErjqDAXi7NtzRHg2WQSaRSq DdE22FDeQ03QqialWmgCpfgJXSXHtC1E/zplzrvCK6W1rvjGPaXqENEzFUIydFyYYVW GFIBUtXV7L/+UVa4CrteQfzXQN3bA2jZoq5jzSWo= Received: by mx.zoho.eu with SMTPS id 1773577220817555.7823977868879; Sun, 15 Mar 2026 13:20: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, Josh Law Subject: [PATCH v6 06/17] lib/bootconfig: drop redundant memset of xbc_nodes Date: Sun, 15 Mar 2026 12:20:04 +0000 Message-Id: <20260315122015.55965-7-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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 06e8a79ab472..fe1053043752 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 Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 8BA3834CFD7; Sun, 15 Mar 2026 12:20:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577231; cv=pass; b=mla8mOsgZBSsT8xpKfAMSbUC6/O7lMzeZF085Zf3dDuvOt/emZ1rzK5YcvfygvM4GgA03IDlglvG0m2g5EucgWS9pEcSyz90izMCu/ICbKRgDjunzhU0xJBCTlDZ6nBUZKvhkpCFpDGHq8vv+1fFuXyDzZE0EW7u+ArsSpvRcjI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577231; c=relaxed/simple; bh=z4qpI5K5VuCGCL+LIB0Pg02CYIyxZaHnByIH+LUn4eI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WfVS6BssVDGEHx7p+u9zig+JUzNwLVURDOW0aTEgYCG5cflyyGiZa9XQaNnDLVPAmQqRQtmSf9tXT7fSfnlYIS36Ae2aBWXlqQ47A0vhK9twFLw6PZGdWzc0M+HlIIbvLEQkaJ/BPMU2UEyFk/CTt8s0aK2VAsyy0/5rgrOWgX4= 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=bAKKp1pA; arc=pass smtp.client-ip=136.143.169.57 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="bAKKp1pA" ARC-Seal: i=1; a=rsa-sha256; t=1773577222; cv=none; d=zohomail.eu; s=zohoarc; b=ZLL0MBYLINXGLTDIPAFtSn1U66S0h8YpBN7YOPRTDzJr0LsecGfKU20hoF6qW6CJPeXB4flr7QxMFB97pxho0GyJFSrCAZLfjg0Vln6/5QEjSCW7I/f3NBusFKDZSQ2aBZTsiQr2Ck+3xUBKZYWYOJuF51B5E7lp2ESJyr8yTFg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577222; 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=MXOFEic8tltWtDaGbb5XVqgdeofWCWWX/N23XVJnftu+zFx9WvIWr9KuPs2po0yuQAgRwZv01Q0uiAlnuncTd/Tm0b/KXQPgpk/trzubZbGfST0x5uLBmhgX+Uvl/GGN8kG0sCUFKi03OaxXBDOxjWMa6GIZarNwdJNZkD1zw9k= 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=1773577222; 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=bAKKp1pACWI20c0PqIr9zYQOcIna+bZMCwei2e0s609Za54pYmu+aXCweQq2+agK BJa7P61wSHZXLA/qL4o7L+Gr2MWFcHnNi1nyRV7Mp8WtPEzMbmNmTPnHhxu3V7PX39k KfvIPvPqKaMDnUqv5roH7vd/3THop89QzTvxK7Bs= Received: by mx.zoho.eu with SMTPS id 177357722137437.60846912355282; Sun, 15 Mar 2026 13:20: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, Josh Law Subject: [PATCH v6 07/17] bootconfig: constify xbc_calc_checksum() data parameter Date: Sun, 15 Mar 2026 12:20:05 +0000 Message-Id: <20260315122015.55965-8-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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 Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 075F634DB77; Sun, 15 Mar 2026 12:20:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577234; cv=pass; b=dymugRBkJVp8rlhFPSb3jOa6kjpN3VKtKbyTFZ/a4WM2Ebr6z4mfud3v6hk5qL0ytw/Nk+zeJ3OsndtEHM7ta3O8G1w8ZskuDPq+fw2OAIzzheerfGnyW5y5Aq6UbE8RPesM/I9fnapomv+fmpriDnmVuKOT4mSjD1WfawQOUQ8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577234; c=relaxed/simple; bh=5jHlNQbA4ax5oxWy6TmNNrMnctsyCd5kWbRwYKqDhJE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mOZjtH4pX7rNzZPnetKbphlFWuv+GA7dl8PTuiLd+oX/LQgHsw/zwRa0gcGWYLqDd21nazpNA+61l7kVONkPbHr3MSoWn707BevUoeloCdW/FgP/KqJs4QHkhExSDhJj1oMGalclQMDu4rvkCWDdzj71Ss8TKj4Fn9g2vOPITsE= 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=KeIlqgeK; arc=pass smtp.client-ip=136.143.169.57 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="KeIlqgeK" ARC-Seal: i=1; a=rsa-sha256; t=1773577224; cv=none; d=zohomail.eu; s=zohoarc; b=fzJop3IvxFk1OHMw1VZZurYKhK5fo2L2XO1dOYAp7YHxvIeWG78jbcJFG9j1Z4XxXw69idatmOQPw/3WrkePbxQjdZ56unjMvtyWFwsG2HuTl76sT6//1mOo54muvMRFpS0L2lQ0KQg2eYK9DQS4XsWaueRgj+hC5A5eRDQs5Ts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577224; 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=RAInAapaPEVVIMyMy0xQq48ym4WbDouBno9PBv2kGos=; b=MdqFV7ImHGL1pnYA+cQKayZBKHot66lxsBr8YN6RrRK5JcAZVEfPmQoSHvxrYHWOVI9OWmabe5gXYj1AW4KhwFJNfP+yetZ05v6C5H0917qzmt0AWXcyvpIbLibjqItuOrDfc5FBD/5rc0+0BJIMKiyAfD273LEu0suWfQEBuAE= 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=1773577224; 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=RAInAapaPEVVIMyMy0xQq48ym4WbDouBno9PBv2kGos=; b=KeIlqgeKkJXZbsFJeKYsJFiXMe782hjM0bv+rznNId4PLlfxctfdv94eQ3BHCoG7 y5toZjv9lR9vvLcWpWHtyafVBlRRqrwFGNaHv7QpUv6MCX2ts0nAouRwQWK9AqRQIQA rpamLmoUESFwUxoJBKCTftceSuW2BVr8aMYyK0g8= Received: by mx.zoho.eu with SMTPS id 1773577221934891.1839683517646; Sun, 15 Mar 2026 13:20: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, Josh Law Subject: [PATCH v6 08/17] lib/bootconfig: replace linux/kernel.h with specific includes Date: Sun, 15 Mar 2026 12:20:06 +0000 Message-Id: <20260315122015.55965-9-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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 fe1053043752..0823491221f4 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 Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 2277F43ABC; Sun, 15 Mar 2026 12:24:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577472; cv=pass; b=IC+V+dQnFrhOfCmKZmgpGN7kLP/qWF6C8y5TUHz67ujhEDQjdFlJzOzv8wwbe4WnKNMurHqsFtDHOoQRPd16olc5OAggeKG6Oygzub++EmBPZpOKt0biqgMxVek371TT3LQQHskgkeuVASkCKl+NekCQgL/yXEY/vPLOJFTwa7Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577472; c=relaxed/simple; bh=ZuUlVeCERGWi0kiPXUflzzixT8Dr5l8GMnBPX34kkGY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VBrCnbhZiep4RcXQx6DPtznSlVIcMPMA9GVleU6hjCN3x2ptNBi3t1hkfxar7204KnCp5DHtePBuvgB7oEh0HpqoxMmyT7FXqOIsWfcRr22DXx3x8oKG1XvS+gdKyzmJfTzNmpkBNuJ380mgzmbXum/pAKzvhydMDXMZEGDeapI= 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=kOFp3zYj; arc=pass smtp.client-ip=136.143.169.57 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="kOFp3zYj" ARC-Seal: i=1; a=rsa-sha256; t=1773577224; cv=none; d=zohomail.eu; s=zohoarc; b=cxZf4aGVYpItIiuLs0S8ulqrCsIVHHObuLpnfyy6i2QtCsvWtrHFeBDVRQp9gtXNMr5Na4al00VwbIRSwJfzcdCly7QNfIeY9Q8tEbNhclUOSaBzTe6uIWV35H91nw/KUiUgpnpVT8QHP88pikR2SY6P6NPuXJggZzlclPl5PJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577224; 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=jQa+d6xwRxy5WvG4jIfj7hMRpG3HkL2h6UH+aTlgbd4=; b=USU1j8kHadaaK0+Y5irdXLsxKRCxBEtPheKHs7CDjuODrLp3WhohnM+S74twRYxHBDuaK3p1HzH7XyXrQuVCZHLF+Dce9vUvXmE5I80cvECqHq399cVG7uZGBlMCUGb7W1wG0bsohVhXekBU9WvZ29umIJ0qUVoPpdLeHtSu9mU= 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=1773577224; 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=jQa+d6xwRxy5WvG4jIfj7hMRpG3HkL2h6UH+aTlgbd4=; b=kOFp3zYjYZkGnqF9jTg9A1uOJ71wuvUeKvSLfs2TDZJPLRqlLunV1/2/JuCLgL4F YUNrcTtcaw0DqkdVtQsebHTFkEKaNXW4fx/w4KeCCoXJk10X1dkkKD56wiPCg4xrrlR 6sXFHW5u/s17KIgDaZMHV4nWMsQSR4q8G3xJg60M= Received: by mx.zoho.eu with SMTPS id 17735772225191.663051885701634; Sun, 15 Mar 2026 13:20: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, Josh Law Subject: [PATCH v6 09/17] lib/bootconfig: validate child node index in xbc_verify_tree() Date: Sun, 15 Mar 2026 12:20:07 +0000 Message-Id: <20260315122015.55965-10-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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 0823491221f4..038f56689a48 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 Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 8A50C35294F; Sun, 15 Mar 2026 12:20:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577238; cv=pass; b=jZ7NyMFmo0qYyN5L3brgaRJZr5rFHl3MpUa+ZwQ8ZwkjrmxA9ma7iWWTDheT1GcW/9YE+8cgHqfir8S29f/ki/E5sH5FbMc99usB7dw0CeUbY7pjVgu8R/Looq3z3h5cd7b58nSaw6pZ1vsRoGzJTd7iYqAVej/Or1F66O7ibus= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577238; c=relaxed/simple; bh=ZFHhcduH6BPu+n2EmpRHQ4MrmATKI3qjWWcYFT9yzww=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BpBDc4GtzW9DT3NQ2QEjqiJnC0CNQC3t7lHJwOAnPO7jv6SI541u7UFOXxAbNTcmZAzxtWnG4kPk5foOAzxeeUGCndaOoaw4ua+CFPrN9X+ZbkBmZFVljsjOOWlP4fXvXrVjYvyvfeI7CU16nUNtD/N3EIqsLMG+5/bvQVAYh+I= 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=nXvOphPI; arc=pass smtp.client-ip=136.143.169.57 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="nXvOphPI" ARC-Seal: i=1; a=rsa-sha256; t=1773577226; cv=none; d=zohomail.eu; s=zohoarc; b=eWCPNp9e1sccsJM7BPCsrzJLhEZSjNntsURoDuSrNyOR7SL+TrnhPnct+/vIIt4Mxba5m8o+FvyPwyDnzIHz7Ro4AbI6bW3Ig+1DQ8qZakCKEXaVIk5bIAQuhGXPrzMyfYd90DpjJSaf6mWYKgfMRVpkszxWz6ZRoPOzK5gd/UY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577226; 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=8RKGFqygVzwj3nKGmrh8LIQUomaXoUXBIT1/jbFgSvo=; b=chqbabCoLwVRVy/9/gKOHQ6hTLDcTPPcyPG3Qw+EIr9Om46lEBgGQbwuES7WewPBeAeDc3YatetG+GuPT3v1zJmTXF04ouHhQKcKVE8E+OGDXwKYqL0Q/knSBc0t6lKvpm1Ue+SwZXpZ7OJFyiecERRLOxD/diuCOiTLzG8bx7U= 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=1773577226; 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=8RKGFqygVzwj3nKGmrh8LIQUomaXoUXBIT1/jbFgSvo=; b=nXvOphPIDktM2/Rzo4xsMpFWZLcrfdEid4RMUmtiT6v6KMW9+Y/omh5idV2xUZhO GH2STpEZ+RuWxGVEGLYb8IZWF12lIYC+SM/roIdyUUHr/plZG2NLf7zqSUIOYwedirP wmUqtPhrBq2kCNF0bRTegJn4vjSA4UYK/SsbVZoE= Received: by mx.zoho.eu with SMTPS id 1773577223085138.7012228454397; Sun, 15 Mar 2026 13:20: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, Josh Law Subject: [PATCH v6 10/17] lib/bootconfig: check xbc_init_node() return in override path Date: Sun, 15 Mar 2026 12:20:08 +0000 Message-Id: <20260315122015.55965-11-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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 038f56689a48..182d9d9bc5a6 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 Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 BB22E34D90C; Sun, 15 Mar 2026 12:20:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577233; cv=pass; b=rYP1raDyN+pSBabWq8AlFTIYW9wl4ZwBBmimykHY11pkoNKBJS6dma2DNtAzWTPENoUDj9LRHlrH2i2kURplhJIQD1rZ8Qx0xy5yMghj3M+9PyP/sb3Ypj3RRqtFAoK+4YpmlqLWx6MbUAg8d1ny9gYTRhmw9RIL9xIyo7KBscM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577233; c=relaxed/simple; bh=vcSmVPwd5atv4aQqUiSSsIWmabtFEECei8nDhBxO4fo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FWFnaTvQOqTrG6fYDiX2K634IxKzza1ACX0sRcJWudjh+fxxFLDpqn3xYplm5TyujRi7V+tubdBpq8t8KvkYZd3brsfjZmcWMerHvhwtDPKNntoxplBCgHyaFFvhLBvrpUR7iLXEeILicl7Q6ETIzMocTXV90Mg/v0QvGCnn47Y= 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=Rq8zi744; arc=pass smtp.client-ip=136.143.169.57 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="Rq8zi744" ARC-Seal: i=1; a=rsa-sha256; t=1773577224; cv=none; d=zohomail.eu; s=zohoarc; b=OQtTEOPxK2C9+XWZfDsll7t13itgHEnWOG/1CBUZWBaXGiTBZJ851ZEjd6lQYwKvPb1aJN671dis+d41xbXlCON+HcsWB+2HEv5LhNfP7axAg1ZyNxT5tEbi9xiGZYDnUEbNXyg//s0ex2nt5jx5THmvmEAUJeBhkpYp5U9budQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577224; 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=YdQAiEyDpvbZ5I8fQtAjbQ+JeayCjZ3yazt4egZHOB4=; b=Gefjvlf/Kwbwl2fCdaGBDuI018PZfePNyXfLIHO0ya41PVMsYuIQVuO/kDnOp5S4O/meadCf3T9bnKW248P9frFYh8roA4NPwrXQsFWrRS6u6g1Z+ScEBJof6D79/YsQyFU1Rm6Y6j7tA6lLyjL4wVBbkFRXFHgbSmDXYQcDVMY= 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=1773577224; 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=YdQAiEyDpvbZ5I8fQtAjbQ+JeayCjZ3yazt4egZHOB4=; b=Rq8zi744kkDoSfapYn1Hdz6PjIvuGoP2HjAsJln/DryltKl/yVBh2qeG9mqZpxQG /WPOdlcFWCg+HbAkqJTR0jAzoiQXKR7OQBbTzPirNx0evoPQyrqMDKQ9AEKUvtnZfwX 8KccAhfoSIzNFTcKEjsXEtsTabXiYoLsm9/FPXP4= Received: by mx.zoho.eu with SMTPS id 177357722367761.91944581690507; Sun, 15 Mar 2026 13:20: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, Josh Law Subject: [PATCH v6 11/17] tools/bootconfig: fix fd leak in load_xbc_file() on fstat failure Date: Sun, 15 Mar 2026 12:20:09 +0000 Message-Id: <20260315122015.55965-12-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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, load_xbc_file() returns -errno without closing the file descriptor. Add the missing close() call on the error path. Fixes: 950313ebf79c ("tools: bootconfig: Add bootconfig command") Signed-off-by: Josh Law --- tools/bootconfig/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c index 55d59ed507d5..8078fee0b75b 100644 --- a/tools/bootconfig/main.c +++ b/tools/bootconfig/main.c @@ -162,8 +162,10 @@ static int load_xbc_file(const char *path, char **buf) if (fd < 0) return -errno; ret =3D fstat(fd, &stat); - if (ret < 0) + if (ret < 0) { + close(fd); return -errno; + } =20 ret =3D load_xbc_fd(fd, buf, stat.st_size); =20 --=20 2.34.1 From nobody Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 B454834DCF3; Sun, 15 Mar 2026 12:20:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577238; cv=pass; b=TT3CyqNFVp1OZHwqWG+S2a+g2XxWcubyyRUCQVoFvJjslVSClDyJmMiKb5RBwbJnx4+KNQcg6EdkE08YoZQAZ40EgWfJDa/5qJ9PTKyf+yuhgvjfBmrRhgStZ6X8JT4gekw7tguxd6sU6YJCGatBPkn8zEp2UKVSCmbrFNaKasY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577238; c=relaxed/simple; bh=BT2q2siZTg8dVM/8aVNchawHfLA2jp863lq7U7GCyhw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=inj9NnXt4zhs2oBGM9RWtxYxrJCyEpWFEAGTUi575UPNoxH8KMsNnAuHORpvUz0U1KpZsE7PLLOXpoRbROdDS0j9EzOM2TShqx8QPxT6mfx8DtGKXs6baSgLJIkNIyDQgl6+58A5Aq2cNq3Qtt/Lnu6mJNV9YVSDWuUOrmRWa9g= 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=RxVjSEdR; arc=pass smtp.client-ip=136.143.169.57 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="RxVjSEdR" ARC-Seal: i=1; a=rsa-sha256; t=1773577226; cv=none; d=zohomail.eu; s=zohoarc; b=WEzm7Z1n7BcKjpYygfa6jsvGnD+yIA2y6Itsq8YzubXwFn7Zww0U5ekoxvUj8bqeWLBsAgl49j9tSu7FZ0hmzTDnFSLM3BM6CTYOfkbVt2kVBZ4Ok0cc9S0zjzB4Kxvx4O2vJ69vlFZow/oQSgRFsktv/ysGHl3cQ/L9ElZLx2g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577226; 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=2W9qWDSpL3vKX3csZlcWzL71BWBE3j2mAMm1BmTvlg8=; b=OqQgi7/6rjKdQ7PNiYMYhZR6Z/n8TDDw2Jf+xLE8dWxg6E+WUr7DS8RPCpRnKXLRH8/5mYrle8zThdLuMNVNj/0Ac+eYaRPjg4Cd9iBvQEziZXE5T48IwFeesR7weTEJa8Jg+IwuQzuiKcptekgWjPi5DkYIsQKHuLbbTrVNJMA= 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=1773577226; 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=2W9qWDSpL3vKX3csZlcWzL71BWBE3j2mAMm1BmTvlg8=; b=RxVjSEdR+3xa5yR6lELKHB3ppMMEnlULhQfsd+p/rhL5KzKyEJOZmpQsildW+wKR lqzZaE8tealy4WwsGB+pMpE1emaGwqE9PdBsi4ew7iarDiH3OoIQkKi+WeE4g2ahMya Q+V32NX0dI0rlMSCdk83VXVAh79jT0Mq3DEYdDdA= Received: by mx.zoho.eu with SMTPS id 1773577224242256.9249488294723; Sun, 15 Mar 2026 13:20: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, Josh Law Subject: [PATCH v6 12/17] lib/bootconfig: fix signed comparison in xbc_node_get_data() Date: Sun, 15 Mar 2026 12:20:10 +0000 Message-Id: <20260315122015.55965-13-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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. Using ~XBC_VALUE as the mask also involves integer promotion rules that obscure intent. Change the type to unsigned int and mask with XBC_DATA_MAX (which is the 15-bit data mask) instead of ~XBC_VALUE, making the expression self-documenting and eliminating the signed/unsigned comparison. 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 182d9d9bc5a6..806a8f038d24 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; + unsigned int offset =3D node->data & XBC_DATA_MAX; =20 if (WARN_ON(offset >=3D xbc_data_size)) return NULL; --=20 2.34.1 From nobody Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 9166734F486; Sun, 15 Mar 2026 12:20:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577237; cv=pass; b=H0dMwWb14Gl2O0gorH7JgPAoROBGyL7EC5LjGCTcKVbF4IR+GJIGt8eru1t6hxgBm0atsxrIGehozLQk2pouEfMzjsYh2FbjC76ifQPj2DI9rb6DLZMGkDtOBrcn1yeYJitmyuF07U/IQ7ZGMmY/hkgvgxvyVulxNJaz69jyTKw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577237; c=relaxed/simple; bh=JDJDCRXv0WDR5QTOFLbH+ZVs0fEY0qu7uRZpAINLGYI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HjbfIHR3j0RaBmZjR8+kVzKNi/x7rZnm/ycJGx9wcCoedIZcJ7Fiy9VoJTgVIBswYpGo8Ss04eRwTEFNG9+5y6NRhgXva7na/TMErQJFKXTOSUskJXqhacY65mYgg8hXF+ClEwr+IZ2zHZVymwkOdcXqhbOo8kQ9PpKw6Gz/dYQ= 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=NrlqaE4J; arc=pass smtp.client-ip=136.143.169.57 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="NrlqaE4J" ARC-Seal: i=1; a=rsa-sha256; t=1773577228; cv=none; d=zohomail.eu; s=zohoarc; b=AsIEWT8Q53VoaqgAZYChOEeNrjArPsZW6L8TS/hgxxB0C2MFZ0R64dQuH+DifZzrw10mcOqH64dIHOcb6sDzoivCSg1WCz7oE2qnye3UIzps2a/1Nqe7EfswZHVYYUeTsIENoYmE8MaVio/Q21Kze5smmz3HLI5Gu3PSQMzVg0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577228; 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=c0YHvSlmLDD7UQSPU1JDzf6Bfaf0j0xk6wf6t7LSyAU=; b=Muj1eynKp+HDk0WE1OLiqJT9rTMDAO1ccV+ejPMpCq2tR1S9GvdBc35EvDD4M0Vv8JiEywGkeH28xr3uBuJ2vuYMHLbQI/qFIw05hWsPY/IDfi1jXi4jxoJWBABS1WEmy783dWNNkegVBdviEhw5bDf0zfDz5LOIC6rYFyLsxak= 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=1773577228; 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=c0YHvSlmLDD7UQSPU1JDzf6Bfaf0j0xk6wf6t7LSyAU=; b=NrlqaE4J6FLp5gkcBoxLJDcXx9cm6aS6UgcTOcw+tGXYGIwAWr+1tYNJ1PdBmZXt B2/+ejgypFV0gC4MCfu6O0xNY9Q3F7XO8sPSKO4Do4h1oKRb2PVL3KdbtW2BatR9sI6 F8FMbI6U5JPUydcXlPZPPvS+9ORLMGx8HPUAkQpI= Received: by mx.zoho.eu with SMTPS id 1773577224820615.2709267436217; Sun, 15 Mar 2026 13:20: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, Josh Law Subject: [PATCH v6 13/17] lib/bootconfig: use size_t for strlen result in xbc_node_match_prefix() Date: Sun, 15 Mar 2026 12:20:11 +0000 Message-Id: <20260315122015.55965-14-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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 806a8f038d24..995c2ec94cbe 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 Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 4F3B0355026; Sun, 15 Mar 2026 12:20:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577249; cv=pass; b=PqOD3fch/d3ljaAuvAXW9v2qksJ7K6JK7prMt1MwbebM3evcz999miuFrghh6A5WljVAfdoPQIUrZrSUmY7l8oPDwD9YRJVmze/Dl8W8IFAnoDmJ0av8CLKjeCFIhc8H3PpmclpXo/LUEa5mrAM5o/Bek/fEAZijAEA13EDq9lo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577249; c=relaxed/simple; bh=VKHopRg8IGdNLejmjRomK8lHiFXp7Lb7z8zk3mjsIxM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PMpASOj28XNOOc2+efcz8otOOuUBoT/WXzFahVv6lTb+QZbrKkv06ZX1bwY5BMiAhlU5yM8NO0bkerHdyzY5RmPLimyc7d+M7o8d2cMtTNsygDexrD618F69XN2CvitpueSfUQFzPcQfPQWIKWEPLJ6NpGUEs29nv1qJXfiHWMs= 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=hCWmi3nN; arc=pass smtp.client-ip=136.143.169.57 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="hCWmi3nN" ARC-Seal: i=1; a=rsa-sha256; t=1773577228; cv=none; d=zohomail.eu; s=zohoarc; b=b3oT+w3ML/Gvp+fen2cr+MJQJp24um+vl1K+GkZqMb1fOAQlpX2uYzb4YHSlQ8ltHjnWLxXmtiPyEumEXL7ZZbBFkhv2nO9vyI0StYSW24LX2j+mfFsNQXx+4lIKFghb1huZHoCF4DPqSKUTqqfsc7QKfkQAC3oOGeLt94uozws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577228; 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=t+zefJeSRi22Rvky/gfXxqncChjmAVugRoXXQsGEHR0=; b=WAKPKlnCWFSFQb94XKeyWNG99Qy42FqErYlJbmJgawGydxoBHxHBOK5qy6kJhR1EYuWWewivWbYnrmqWL/xA67E4Hxx85gVPsqTaGBz3F+rKfm13dqz3DZwQinGBnUHTl4tVqseff8YWPm6PVDAPGBrcXIN79EMkKaL0bQRE6FI= 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=1773577228; 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=t+zefJeSRi22Rvky/gfXxqncChjmAVugRoXXQsGEHR0=; b=hCWmi3nNl36KZ8MNp5PFeC1T83gFF2O8UC7/uaBuBG0PWn0nDCa8XUP0pohbn3Tb 3Y8EK5cf6J6KAEVezydCt0lcIMU7V3kz1F4Z9oYRjxTJ9g3rlGv8Mo3YmIgDcbBhhYr JgBlpwNjb2WAntYTBFtj1yQVRCI9COn/7NEwPtlU= Received: by mx.zoho.eu with SMTPS id 1773577225379866.8544584576808; Sun, 15 Mar 2026 13:20: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, Josh Law Subject: [PATCH v6 14/17] lib/bootconfig: narrow offset type in xbc_init_node() Date: Sun, 15 Mar 2026 12:20:12 +0000 Message-Id: <20260315122015.55965-15-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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 long), which was stored in unsigned long. The offset is immediately checked against XBC_DATA_MAX (32767) and then truncated to uint16_t, so unsigned int is sufficient. Add an explicit cast on the subtraction to suppress the sign-conversion 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 995c2ec94cbe..7296df003459 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -412,7 +412,7 @@ 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; + unsigned int offset =3D (unsigned int)(data - xbc_data); =20 if (WARN_ON(offset >=3D XBC_DATA_MAX)) return -EINVAL; --=20 2.34.1 From nobody Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 384F6354ADF; Sun, 15 Mar 2026 12:20:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577237; cv=pass; b=j6kXmbzr1Ev5xSf3Ccnf9/p837091plwV9SkaBP194AOjG3/F319tdwDtvOFN3pVIZKvq5XDax3oaggYDtjNhjRZUF5HbHvp1Mxx7wEPAYjB66RSOlsJnQNlu1XtGdHchu8a6HX/xCuWrdwq/x0iK0Auefg7qfothQULBNBdbBY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577237; c=relaxed/simple; bh=J0dWEtL7oD28UFrLKGwL9fzqAkzoGMhBDWffJqXgq8s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ADCguAcel6+Byzz29qCssVSyWjJj4GQsJH4rc2Z5G4vESP6chrq/oijPMS061cGDtrrVOdVwKTqu9mruBo4SEzyixwYTphh+u8xnn4ds7JYRgBxjQW1RkC8OzGJ37AAykoHj4CQAdMO8/K2qkNugIlXCK2kXIup7l/xFIMztlyg= 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=Uk7WQh4d; arc=pass smtp.client-ip=136.143.169.57 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="Uk7WQh4d" ARC-Seal: i=1; a=rsa-sha256; t=1773577228; cv=none; d=zohomail.eu; s=zohoarc; b=MGEc66PDLw+Gt3DO9nxX/Jix9oGN807AJ7FXnLfbl0idJUsRP0WsVbKkuVI9ebAspTaVQVNYrqfeibjlegAgW3cwry1P9shoEFxMiqSs7LhYLQi5AshWywaMuRU+R9dilOF7ANpxKls5+310QHHwhkMMfVrDFFTUwpdkubi54YU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577228; 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=DAmDK/t7v3VayM2/oeJKOAUQv25rBNApZIKdk5FaALE=; b=Tj+zWlieSxrFX31j7xtkR8aXxrN9jw1sn+htnx4jVEZfaDDDMP79kpaEk0LyIs/QTbDhE/Z9SwbsVd0by88QDVSysBcEcDBqK91siWxmyfiWTi49st25mnO/s/vjATYheheAqzc8P89qJDM+3b6ACSTLpUF4DlYjYs/YC4zu+rw= 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=1773577228; 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=DAmDK/t7v3VayM2/oeJKOAUQv25rBNApZIKdk5FaALE=; b=Uk7WQh4dKL0EvcvTJPQ3WoC+A3UsxOJtBqTNNjcPHz6Fk6b6r4RlWaNScotcCfDE tLC4cDvW96gu679esGACg0KgdClHSNNkTfDxOCNR/3fOdqs21f6DGCdL1GnSKModcfJ qiDLX/0XpgFa++1XXtKrVamkzUbcs83a8HMAOPlw= Received: by mx.zoho.eu with SMTPS id 1773577225930577.223199494676; Sun, 15 Mar 2026 13:20: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, Josh Law Subject: [PATCH v6 15/17] lib/bootconfig: use size_t for key length tracking in xbc_verify_tree() Date: Sun, 15 Mar 2026 12:20:13 +0000 Message-Id: <20260315122015.55965-16-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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 7296df003459..e318b236e728 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 Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 4F2F3355020; Sun, 15 Mar 2026 12:20:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577249; cv=pass; b=C+CUopcmHfdlWslvB6KSXxkTdWE9zdFUoYRD4HWGhgDm1zBnX/Hoo0py7dyLJdHhxDY5w/rR16BzHd9Vg4qC8iZhVnxbDnKNpaX2ThUTZVteyzIyKo6hAMbc/8XA0lsvbJw1WiHhkQsBzr/aBpmbzPm8g9gxhFLDuPax5J0PRtM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577249; c=relaxed/simple; bh=aXdlizYwRg/M1AMKSbsJalT/nUfz1oUAK6W0OZTfMtI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ceiBVjKrT+4sVPc6+9dCua+6aK0xu36oREqQXOAovQEHika8jqzg68fkW9QD6Y19PpsH8lrFqsWe38u6yieyT/PXW3703KlSHIpIji0QKcJIyxq97bxnW4/kTotp200wj4HiJXf3OPTe4mYL3+ITs/J4EfbWrSw0zJfEhb//AdQ= 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=PlV2aN0u; arc=pass smtp.client-ip=136.143.169.57 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="PlV2aN0u" ARC-Seal: i=1; a=rsa-sha256; t=1773577228; cv=none; d=zohomail.eu; s=zohoarc; b=lQwd2M/j5sNJNBL8ODObs3jvcMRsh3qzosnphDM+Hq4eOgXfsnBUHeYKN4QwewHan4fWZrLly42pyz9RJbQncFEOVekTGq4Z19+y31OvbeWQdX2qnkZpqkIyQdLEQtxvGHxkJnGdza7pK4i81lygqsB7EmcvvYUfziorTNiU3Vw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577228; 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=ga7f0GX5euej9Ul7YTpyJfwhI+upMhqgl4lvCxDD7gQ=; b=G8Rvs450FTnttialIXv6RdM+SJHi5NSvgNpeQFDhSFMtd/cmuieCOhjPaobDd+3SjOTLwaobYI0EnpdzNV5CD/VCglH3v+lHVRrbPz2Rkr90uVibSy+LgalTLXqZg88k4ejk0iphgN5VROw/WMLdbrDVqDcR5sBPU9UrbBJ6L+k= 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=1773577228; 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=ga7f0GX5euej9Ul7YTpyJfwhI+upMhqgl4lvCxDD7gQ=; b=PlV2aN0ufHep8p8kRNCXohC/qxHBHsIY9lzH0xv7dda3v9v9+oap6IyvxmsCVdJT ZgWvI7ryB6UH91sRfMydRlCgbNbT3ULlvSFZuHIFV+w3Rd79Iok3P2HcnzQEJf6dH4J p/+XCtYS95e70A3IqSBWCDD6HfkAqhUoetJ69GSg= Received: by mx.zoho.eu with SMTPS id 1773577226489970.3035499984228; Sun, 15 Mar 2026 13:20:26 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v6 16/17] lib/bootconfig: fix sign-compare in xbc_node_compose_key_after() Date: Sun, 15 Mar 2026 12:20:14 +0000 Message-Id: <20260315122015.55965-17-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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:322:25: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' [-Wsign-compare] lib/bootconfig.c:325:30: warning: conversion to 'size_t' from 'int' may change the sign of the result [-Wsign-conversion] snprintf() returns int but size is size_t, so comparing ret >=3D size and subtracting size -=3D ret involve mixed-sign operations. Cast ret at the comparison and subtraction sites; ret is known non-negative at this point because the ret < 0 early return has already been taken. 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 e318b236e728..68a72dbc38fa 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -319,10 +319,10 @@ int __init xbc_node_compose_key_after(struct xbc_node= *root, depth ? "." : ""); if (ret < 0) return ret; - if (ret >=3D size) { + if (ret >=3D (int)size) { size =3D 0; } else { - size -=3D ret; + size -=3D (size_t)ret; buf +=3D ret; } total +=3D ret; --=20 2.34.1 From nobody Tue Apr 7 06:19:58 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 E7947354ADF; Sun, 15 Mar 2026 12:20:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577254; cv=pass; b=CotB1cS7PyJ5HyJDWwiP5Ldg0DSnBjMm/TfWA4z9UT92LiUL3yyp4l3SGOqJA1JnbeBusYOCdg/iWzEmxoOSfOpdtW45eTBgwKwtqaEUcMhCp4UDRonnQ3yj1olTZR0X/fgoo+fv7/dFR9P7xLiAbLy14dLLN6dhEu6CnMqWzAY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773577254; c=relaxed/simple; bh=NJb0PfVx2IEUEXdGwnAshKOKOsoCjiLfgSxsXZPvw2c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cNHB41fCch9QbPl4turwgOJA9oDZ+PHOGO4QXjYch6OnOIUga+Dra5xuPvnmdLogOe+prRsyAAR7DaYy4G8xhXyLbnZJ1DD4oxRdif05J3RJNnFzBtvEEZmKe/tTztnMmpolXfpyl+tgzwMGEgRpEABl84INQ5murk1SexCLvLw= 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=fovjcEc7; arc=pass smtp.client-ip=136.143.169.57 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="fovjcEc7" ARC-Seal: i=1; a=rsa-sha256; t=1773577230; cv=none; d=zohomail.eu; s=zohoarc; b=BGaPNOJeM1xZUXgPCGhV86EYJC7S0T2xebCgdxbkBjwm8u1zgVExmdpO5RR8w/3gexRCLGGotjOl0guXV+kVaMneCusH6wgmdIpXXP+NCyJseYIuwyEA2i1gfi2LakcTre2jJXD4JHAWW2HI4HryXJalIMCZyWKh3jRSxgtNZl8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773577230; 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=eg017Ee8s6ss2maCA0kRT3aMT33sR6JqGAzxxAeSigc=; b=Ud+Px96tXeYltAnu1rCi/GOAXR/TlEdT5U/liyzp2x59D+bZrKbyT2ltPYGCgLvGutAoTZmKPZi1rhKJqh2Pq0HNzMpwpAZlx2wHlgYq4kXmiElDA3ptnfQmhzKpyxE6FKHlJtzPuU9vcT7IUQnspRBaoqLGuhmaXdM5Mq02+nw= 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=1773577230; 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=eg017Ee8s6ss2maCA0kRT3aMT33sR6JqGAzxxAeSigc=; b=fovjcEc7NpiJAC56kFNK4uMUb1FTnNImKM4YgdSTudxoAVtqA4HgWstsPNCp1qka Uhcy/rTus2i0yADitrT2HMUIjgBcMBapfLCg5ycM9SXCgdNJAxEFtUWBL2bBiKzx+yn P+8Ju2MH5tyYNqhVry7BycWXZ93LRbUjTaPz7LvI= Received: by mx.zoho.eu with SMTPS id 1773577227076927.1548014143685; Sun, 15 Mar 2026 13:20:27 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v6 17/17] lib/bootconfig: change xbc_node_index() return type to uint16_t Date: Sun, 15 Mar 2026 12:20:15 +0000 Message-Id: <20260315122015.55965-18-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315122015.55965-1-objecting@objecting.org> References: <20260315122015.55965-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 68a72dbc38fa..148084abae12 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