From nobody Mon Apr 6 16:45:34 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 C0F883E8662; Wed, 18 Mar 2026 15:59:29 +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=1773849575; cv=pass; b=Ggm/+ltEKBXCUS4uyyzeVkRqgnvoGEGCBsyDwQ2s1RvKzYQMPJUdwVF5n6vcQe3syptfmwX9On4wEnKMJgGsreA8Nqn5uZfmXMKWFrbhaqKr2TgKn0BJYcalkd1pTLIrKCVlm8dCzC4nUr8BBKGMhtgtcSHfoGyJvJzEkF5uuDE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773849575; c=relaxed/simple; bh=wv78ftcSG/DocPbKu+mkVk4aNLSvNs5rs+zIciiAp0Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fyWji/SUgWbbugkDgGzmkC1LsfXoabDJdE+T1UCzbNWME9xbrsVS7V5eQfl1Owe8RRbK7ieGAVTQS9HIdYA6+J8wvmaK4ADIilJdSbe5hy87rUyoQmvFeTsA2SP9K6c+/Z2Uxic72uKQRWZ/0rX5RgSqzbzufCHrFfFhfiIYka0= 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=e4fBSA+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="e4fBSA+h" ARC-Seal: i=1; a=rsa-sha256; t=1773849561; cv=none; d=zohomail.eu; s=zohoarc; b=Dnds9mgZjafeGxV/D/g4K5Wdlp1EyvmMz+yfU7ksNz0yadXK1zA/jT3D0PDosqpln4vpP0e+l1YktmRG+WgjOSNVzbzMfNxx81aKU/KMjV2vOPlmNxo2Mzrci7B4RaL5Nyet+5PXV4M/vtin0BGGcf1KWLuavxIhYDW354EhBX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773849561; 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=Dll3SjMmtmDosZ8MYFa5NTe1UTLQ5i/ovUYCeh27W7pB47CQgce6Cq3+gizRrxX8s3bFcEsyQ+2W8j5FRzY/j0xai2m0a6yWyQpFinDPtN8hrOggN/BlotXYT2kV2g47yv8TivlmecjzluAVpq0gg8bYCb+G6aXuKM2Z4Z8RkdY= 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=1773849561; 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=e4fBSA+hwD0U1vBe5xvfTRFGLIz+FfLlYhigwgBHjcptkRN3Lrf1ma4C0jtM6CTR wvroHJ9N03Y9Pzb/F/75E0h5WLV4kTGm0Ogl/K+uXX7TS0dCwAjHn47QuVX4WSsovsf dhHYM1bdQfP0el4OBSHWAUdrEYWWWyobntI4nIvo= Received: by mx.zoho.eu with SMTPS id 1773849560627902.4012698322563; Wed, 18 Mar 2026 16:59:20 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v8 01/13] lib/bootconfig: clean up comment typos and bracing Date: Wed, 18 Mar 2026 15:59:07 +0000 Message-Id: <20260318155919.78168-2-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318155919.78168-1-objecting@objecting.org> References: <20260318155919.78168-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 16:45:34 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 A9E7D3F23D4; Wed, 18 Mar 2026 15:59: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=1773849578; cv=pass; b=Gydbz9A1sHveSyrXcYqoVjJ2QXD8CHNvwZR64eJ+VLMpxnOfogByHH9itCn9Qqdnw/a4yuynkhGnawD2LC/SqwKR/PcjCc5OmS/RH/Y34uo2AKiaFlYhwXJhdh+qZ/2A6mRnwG8knDmYZrgkdBUu6gFOweIGFAYhx1Aq/o5tu7s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773849578; c=relaxed/simple; bh=6Fo6RSQQSEkzHn7Jh8Smo8YsAtoTRq1YRco2C0K7n18=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SnHpJtoRH90A15N1tIK+cGIIsAdqPh9c31iJqmLIvNAJDYnvVOGQcZbyjMzlCiejsfvJpWLeiF4cbPOTdltsNsiI7CKJAi/6ar+vVRgZBiUVu8CnmLBt1x/9j1X23Qq6IaHmdfaDYLWFvkCBcRaJ75jkMHG+mA/oOLGtbJGvPsI= 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=IGPSqvM/; 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="IGPSqvM/" ARC-Seal: i=1; a=rsa-sha256; t=1773849564; cv=none; d=zohomail.eu; s=zohoarc; b=EtA5AF5BD0khFAK4UxgofTjCtmJ6w6gTSwtKBRI9hzlgqE7Fo8wN0Fy0MjL6F9q1vsQW13kUm+AqkLY10aVtyXMiKmy1GDA+nV4yzjpnoGqDXdQ/khmt7KhX7X87nD21hYH70B6NJ+JsoYtIrBUT8A/+zlYUdK9XQnEaRopiSnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773849564; 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=AfbOdwf+WGIC/hfYb9/jeyx8XcmgBr00/477nYVe5hSBh/K5kBhPCMprjqZUo0T8i7UrDjl4Gcl9EgRiAFO31o8WhpBxwtv6ZyDRGAuYQREb70d+ghpTbH6vEMbo4hYNduhSGGZhXkBjLY8Phu/kGMSGJ6gzZzMy3a/rzRhetmQ= 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=1773849564; 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=IGPSqvM/vh+MMc6Nmpx1J75JaWkgl6/I+wLxNvN9TqjNWt8V6EOJpw6u6fDFeyni NQOwbeP4HxjQInK3d8npLb7IJbttXXrSM2xipJcU6tl+Ti6hU0Z5CSG/0QON2yKm7bj dXAuhptdYWz8gYF2a4cFtprBftnBCq3vPBkZGQrs= Received: by mx.zoho.eu with SMTPS id 1773849561111381.26346423146117; Wed, 18 Mar 2026 16:59:21 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v8 02/13] lib/bootconfig: narrow flag parameter type from uint32_t to uint16_t Date: Wed, 18 Mar 2026 15:59:08 +0000 Message-Id: <20260318155919.78168-3-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318155919.78168-1-objecting@objecting.org> References: <20260318155919.78168-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 16:45:34 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 5826F37AA7D; Wed, 18 Mar 2026 15:59: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=1773849578; cv=pass; b=jMO2j8vvDjxqa5qXV64eyPx/TygE+szWBtHkaW1zEAb+0TvwPAFVUo5oSI7ZZx7A2AQcwmPdBAWbho9PwnP/53h0RFcM2GlSFEprIYjwa6mZH/kqE0RT5pbuXJNievLRs5N6iQrPu71w2owCOEWwG8NjLmOhtsCBHyDeDVl2yDw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773849578; c=relaxed/simple; bh=37+w50eN12giG1sxYBeLrwDs7oYHGhVLDIPSz3ka60s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=N9y7yvgFsRjOb2Q2NGmebe1tDXW44QwolcnuY1mEJyq/k5r2C20+OnDb2sTTgenC/F+ajZsp0ji0N0Eyj/QRn8bt25I5ofT8JPoH0T0pQ1brN3qBvdm+MuIRdx7LkyvaiFgjE+cPXVFpfV6y8zPr4+CAnsTvYsAkZOs2j90Pp+s= 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=lstcYk2J; 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="lstcYk2J" ARC-Seal: i=1; a=rsa-sha256; t=1773849563; cv=none; d=zohomail.eu; s=zohoarc; b=lSOtl9pufybga/2n4wl0D4uFGTC6MBBTwuwznDoNQRV0fy658HrZStEM6vjzAnqHAvRrxBQYlIWDSrPY8mgUCLqvo094efV/iuV7mvAyJ4gT1Tk3Q95rreyTFlyX5wLzCzkL8Cq+R/i/t1chTDd1ioby9t0oi+0oTgf+gV5d3V0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773849563; 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=jtqu5klUtSlQRtCmip0zv8fFy7PBkjD74rfl1YUcvLuOFtQNbhkQuvYF8JaOZo3s1oDzoKBkWoxu6q4tJxX8AueqJDpraahoddV4eajp5yeOWceiyENJsITj6rXxK50ES/WNyS777KKcQwTREs6qRJ5K+uCk5eLkKb2Vg6fCR3I= 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=1773849563; 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=lstcYk2J6V/vM1s8PP15ST3GkK6zbXH94R8lGifm3gNtjCjsi9dAdBcbvGbVKyB8 /Wo/R3G6fh3Wl6ImjFxXmxVO9h90NV292TyUpFGlw6mBm77s3WGYWiyclUUsG8jDLq2 9lhhgjdStBZP5K5vJZxiPKMQiQLOwpMz1SisS3m0= Received: by mx.zoho.eu with SMTPS id 1773849561598528.7915120494015; Wed, 18 Mar 2026 16:59:21 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v8 03/13] lib/bootconfig: fix off-by-one in xbc_verify_tree() next node check Date: Wed, 18 Mar 2026 15:59:09 +0000 Message-Id: <20260318155919.78168-4-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318155919.78168-1-objecting@objecting.org> References: <20260318155919.78168-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 16:45:34 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 A8AB23F074E; Wed, 18 Mar 2026 15:59:30 +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=1773849576; cv=pass; b=fjvrC4BDv5hNyN7l3EXw+WoePye0NU0eNw0Y/bQpO0dj1B1jDj5vGzsNWCSqWGGefyVH2bGGdoAOGpq1W+8L359kjhrwXyJnWyTTb2VQYdzxgTZTPg6MxD97shRVvqfxL9/Dq6003o5tFHQc9u/vALQ5HUlr22z+TXKanN/h+Yw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773849576; c=relaxed/simple; bh=3tM5KwMKBZ8z8auFLoGZ8L6+Lizhfgkj6R4OpQaZT/c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uTa4PGFeylXpQJniOdWrkIq3oZDH0gdARsyNmoBfl4lI4HurzU6CMDEottbmP9iIduYd5n+oU2awPjfLOuDZoxLjiN5nlHT/8bNlKAp8fPMVGS0uKu3t6jJOZ0qhA3/5RmkbIUsDQX+hVGTbXJ9c8RlPij9Iqia73C5abhucb8A= 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=g8rnv1xs; 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="g8rnv1xs" ARC-Seal: i=1; a=rsa-sha256; t=1773849564; cv=none; d=zohomail.eu; s=zohoarc; b=L/dWhKU2rt73GTN8qzcZBg5bS+TRTbvD56OgA53uvZU0U+agEiJKs0o4fnJr2KtylMVMmYlEQLnY/WKOJO7yI946YaspE+b79JokA5MvU+DXVPEXRr1MI0FoMrg+QsrKtmYoEpuOV/aKSMoeKbAJp+DpGx6QBU30i3dozw11+/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773849564; 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=UONOB7qGj5KBiaczVIvSfTZ0AZQSz2U+A0KI1tm6WHCRyeGdEyEZg3Fl5inTxCsYZaPDqb1LkpqocGLKIxdL/mmvq9tHTa/hg7s5LB3IVQgV+fLW7AXtfIb6V3B+1wZ822wBw8JF6rjTOr6HZszfcm6a5bI/FakJMVfSyumZ4hA= 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=1773849563; 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=g8rnv1xs6emBViqCt0DsCG8gmnhhI1JWMWQphG6T0InloKUSmZTzbdjk9E1l3BJ6 6UEdC1lyHbZ/6+KmJ0WPazOA2GbI+C5EpiG8ngftDxVMz0WH5ONDj3qfDrpydhHIFSz OJ5ov9/JKHScaRu5idSTsDgfqBgc1lzKrV00WZtg= Received: by mx.zoho.eu with SMTPS id 1773849562091901.2862068926551; Wed, 18 Mar 2026 16:59:22 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v8 04/13] lib/bootconfig: increment xbc_node_num after node init succeeds Date: Wed, 18 Mar 2026 15:59:10 +0000 Message-Id: <20260318155919.78168-5-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318155919.78168-1-objecting@objecting.org> References: <20260318155919.78168-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 16:45:34 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 E2C2333263E; Wed, 18 Mar 2026 15:59:30 +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=1773849576; cv=pass; b=ZkcG6haUE6VzcezzEL247wznNz7ZzE+7cCzIqU8Z6nC4QOhVSPq3WRionVfuI6ykBqCvFur0psSmtXQLGo9L2Sabp/JAPRrQBLF9scZ/8+hjMpIenuI7xqZCzaMG/Isvi6xuXfDVFkgdBYv14BrerH5Yo7dJAqmyD3Hw0tk5j5M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773849576; c=relaxed/simple; bh=8XfWUpdfXEDT8M6ObTzeOjROI4BmQBiHqKqE8eCq18Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hp2mDILi5yhAhUKLQA54rR9JbS6pyMu3FY6RcXPf3L42NQV3QBsMSEhmqllHJRNkm/WD3Rb54AIQqgzc3zfPqsmW9OKiVYoSYMT38D3atE9j7VOPKQ1fhsA/Y+BpMV5+dA+vMRk104Fq4+9Xxo6H83AgzAk/C7dX+NsVKwXvLBQ= 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=W6jqcyEn; 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="W6jqcyEn" ARC-Seal: i=1; a=rsa-sha256; t=1773849563; cv=none; d=zohomail.eu; s=zohoarc; b=IusYMW5Plpql3JGAoARiW0LcCoFWp6F4Iq59dJT+p0KyZnJmoyRL4iOxOGesSqsP4SMvhSbK8OGOi1g1084sq41bMNM35OS91mkctg+m1XbbxiRT78oMUl6A1ziKkEq3oUj0o69iHZiViMWvN5VWM8+cFnX3V+Zpq/iiabqyH6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773849563; 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=gdmd64H8uRZzE2IAj3FVnbp1Ubn8mnMAaRk9Or9meokSb86IgjKMJSGUU2IKd7YmDejHPDqck+M56NGlky4caJJQ+kOHpQxG5cmTJyVFO6Lm1qooGhtSzWmrLKlW/e+E8b0l7JHUsXQ699I7lffUHX7WHYQEiskIwN24l69NgyY= 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=1773849563; 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=W6jqcyEnXN8ps+tGoo72FaN/JuRSRhaxXtwmun+bwy/BIfrGMuFnZFxMbjByHoku qFoMTvVSSF3kGwwIl+m9KnAW8L14dCTkfIMxV14FwCOh9OBzTR4WoCCOicVjz29qrN+ l4vBmYat+uP25pS3eXeznaRNS5pundEyIp5Zne4c= Received: by mx.zoho.eu with SMTPS id 1773849562573553.0177423595671; Wed, 18 Mar 2026 16:59:22 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v8 05/13] lib/bootconfig: drop redundant memset of xbc_nodes Date: Wed, 18 Mar 2026 15:59:11 +0000 Message-Id: <20260318155919.78168-6-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318155919.78168-1-objecting@objecting.org> References: <20260318155919.78168-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 16:45:34 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 5907A3F0AAC; Wed, 18 Mar 2026 15:59: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=1773849577; cv=pass; b=iqL7/7e27rP9xNPLD+ZFK8HXv9LNE5EookMuL40kL1/IOzz+ARTFhqicYYori9Vfdt0MyaoLfcVL4sp3pstoDHhiQS8FRUKrmTWOTJgXRAuOmXFPl8LSEJ9cq1gF5qJ4p2V1HajS6lxRIX0dyt8OtKG/qDdTJFJFMCs1KK1xbWc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773849577; c=relaxed/simple; bh=z4qpI5K5VuCGCL+LIB0Pg02CYIyxZaHnByIH+LUn4eI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RuwALx6ATpnV6nYkktE//N/zQbXvRNPDfib/aM6cOn8Vm01vDaycf9StcHPFlxQbcGsFbg+n1kutiOPdi8wllOX15nNmiY+R8PSmeEu0ojr3ilFxFaDEMkMLoHVq2CeH974gTRHE583DDJ8savrXRz2zO+fUxGsUu1PR4MnlT/g= 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=XoTl95G/; 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="XoTl95G/" ARC-Seal: i=1; a=rsa-sha256; t=1773849565; cv=none; d=zohomail.eu; s=zohoarc; b=YV4PPsLt3M3pZfxpwh+Ni6HOwJKYjZpjzcfTXiyDCfCioiPtQJgKa2J9NrnYjsBZqPmCuZ70BRVx9lUiHl9tdyYlmw+T/dSPlNQDZLEA66T9mJb2CKZpsh96GUKeiQNLudamYAuCfF8aVaCyLpViY2dSkI49+hEdATbC5QjKS9c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773849565; 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=ZT50xOhVOOjNgkVZI5YXx9E8e4eizbK28iLQMHQKV9HBBtzKmgbYsO2W9Wd2HUuz0QexFO1Ku4+nj44RmL3n7pOYL1KTpjhywohlO3KdL0Qvy+KKFktju26E4gAExqmbX588XzWfxpUS9NbJf/80750jfTIPrswUcZbPRdBDQPQ= 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=1773849565; 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=XoTl95G/RL4Xv83/B6lzYQwV66FHd19G3BH6fTF4izGjAkmcCIHr8JUWQ4smzAKN fFkzgvx3TXJXD25W1NKQrRUqS1/gsykiMxKupNVxnqkKhbjssA5MoHIkvtsT7fP6k3a cjKQnIXkkkHh+BFmMT9a6wmUs5YPrmPIDtNat95s= Received: by mx.zoho.eu with SMTPS id 1773849563077967.2568130209273; Wed, 18 Mar 2026 16:59:23 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v8 06/13] bootconfig: constify xbc_calc_checksum() data parameter Date: Wed, 18 Mar 2026 15:59:12 +0000 Message-Id: <20260318155919.78168-7-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318155919.78168-1-objecting@objecting.org> References: <20260318155919.78168-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 16:45:34 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 D6B193F2113; Wed, 18 Mar 2026 15:59: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=1773849578; cv=pass; b=eDq3A8KPOd9mjo3uTrCbA1TeF9LLDk4Jaaln+xrFoUTqRR0xkSxcIQtXk+3r2Pz2aHV+OZndCnYkNmSnSpGaO+PMYBVi/qFoVQlMwClzjhk+DkEmOJ8aCNbZylOLHKQ3hd+OmD3wlG1QQ6COC9yssLwQdXkqjlL4WeTr6jo5nmI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773849578; c=relaxed/simple; bh=vGHAAnRSmfkKeoZIkPxL389Ha8SG4InW5EOp9WN4bv4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=q/XgYW7CDtuRFsw0uzV1v2sumMQ1pxfI/683I76lQo55xYV7Cg0cbX+DmBASLyUW6bqVNjo9BL4Ld4Ue7pnyvz7Gw++yiXuuxEdEZfon8g+cY21SOk9+IU4snBOoW3kCvwF9lhPUcAPpuxMKytdk0IE3+PZClSxZfYYAxGy8KE8= 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=GUJh20ed; 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="GUJh20ed" ARC-Seal: i=1; a=rsa-sha256; t=1773849566; cv=none; d=zohomail.eu; s=zohoarc; b=bgL/f1tc9WArj9HMdaujO+9ForTKykAbuSG331VnEn+jcTlWmxbe5YgcXYAQdAhih6k50TfpzbaO73+T9A3NVRgE5M3zFASznFkPS0cnHGRfTSFI4WFnzvQiAZmirnNt7/5P+ZDGXxyuiW8fvM1bv7XlVtuyGPJDR8oWDmap5ig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773849566; 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=IFAoql6ANsFXey+WzeWp45nQiL6Sg08i01SkQWezD9qjq0f9vZJq8r7DBvAub8LnrmnP1WzUWs5X81YtZC5kDqPgnXsq53B3wp8cQ8dDhIDUcIKyyIkV/BgxKyPcyjvIGFg5Ba3NONkWyYIK8vY4mY2GwXQAmtWNc2IwqyREQ7g= 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=1773849566; 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=GUJh20edLKflThhVohw8JcgffUiPtsRRSmgrJY9Axez8e5+TbBH09h+M6oU6fw2Y pJrSySYnEb6YyqGUIjMzeXIvPEhOE8F8M7ZegTVUCKUf1FtnM5aHyPnFydSJRXpHIAT KUaboQwgxUYP3Io2TYdwKpJFc7u6Z+tzfKjeNCqI= Received: by mx.zoho.eu with SMTPS id 1773849563709264.90298413838354; Wed, 18 Mar 2026 16:59:23 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v8 07/13] lib/bootconfig: replace linux/kernel.h with specific includes Date: Wed, 18 Mar 2026 15:59:13 +0000 Message-Id: <20260318155919.78168-8-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318155919.78168-1-objecting@objecting.org> References: <20260318155919.78168-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 16:45:34 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 AA51D3F54A1; Wed, 18 Mar 2026 15:59: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=1773849579; cv=pass; b=Dnj6mx+RG+CFeYSb2aVgqNFyYFzOOafZctaOc16PmOiXQDrEoihflfVLD35qOmZmO6TwqSXnAYvXjcuUnOOK87g8e/SuykJJI6drznXr2NRGBO9S90FoKlbqbV4n7BT4qKYIVlKc+Jb1KCu/KQu+S8Z6kVnFvMKdv+3f88O4krM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773849579; c=relaxed/simple; bh=mcfYTARZ9+qwn1715pM8kGZGCcYS4MRg74eXwnmMUjk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nDcDs/E6v4dDa2xht8GkwBid8hDg0Tm0pJq4t9Gy9ymT59juYoourqusjatFqwwGqI96QbodqggQzEBkphyfU6eQzh27ygR7LJPQ4no4K5wldrHyaPnF3Q2D2Sm3VKBXxv1om018NbW6dp1fiRBK4EdqNz5eTx8SXSA0ikGncwA= 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=SZAIYLE7; 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="SZAIYLE7" ARC-Seal: i=1; a=rsa-sha256; t=1773849565; cv=none; d=zohomail.eu; s=zohoarc; b=VVO2zorH2AyS1vMwuNjbZ654AmkmzuAbhXrvWXOrYda+G+PSmPffadZ5/k7H8UA75uweIeGFTBJgStDJbzY3MRjmUcZv628jv9lliE/P8pIwrWOHqr9q5rCnFpoEhjzJYRXh28p3qeX11JyLJMH1VPHYrBoiv5N1nY02fqkwiFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773849565; 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=i5cx1zOGYH8B1nKCc7r3qCnnnHMVgQ0vngYzZHN32ur+me3XSrFWRNVvu8aJP4ee+2QQv1vMRWttWFW8IXgaHSJCwlFoVGipxyO3sach+yYEWWh0zvlVKbcsr3C5sCHLoRruEXH0G4XW7/drjUxucX08oZQM9hIJctA0b7axlpM= 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=1773849565; 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=SZAIYLE73AEIbBn9YhhmjYE3AStabKqw66cJMDvqPrnNGR59ARP7khfVCcDpWkVc s8q2IVkcy4A3FkxJBUzh/lS1ddEiTeOEW3PYEnJKCEmmOyZ3yKfzfI2TMq+wK421gc+ qJP8K0b6YosTuC+XPqJktVlM7YzmT7p1zNBFdU88= Received: by mx.zoho.eu with SMTPS id 1773849564239402.89581126211704; Wed, 18 Mar 2026 16:59:24 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v8 08/13] lib/bootconfig: validate child node index in xbc_verify_tree() Date: Wed, 18 Mar 2026 15:59:14 +0000 Message-Id: <20260318155919.78168-9-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318155919.78168-1-objecting@objecting.org> References: <20260318155919.78168-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 16:45:34 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 848C43F1669; Wed, 18 Mar 2026 15:59:34 +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=1773849582; cv=pass; b=uqr+WG+WpfasSbAKO+D+TwpgRP814gPWPTZKt99D3RljDsC5PjhjZRG8vKX2dqeKdmgl/nw1AS8FR7MxSd7qs0Uh2ZYSHmIAzwI/RuWyTTR6NL+jUazw+BSzuSPrzRAuAZkyKDfPuQ+bQxLuHL2f4M4yH3EHtV1n3GE/mwe2ZrI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773849582; c=relaxed/simple; bh=k1J7BK/fpcNNRsuYpLDEr6NUfHMMBv470GcUJe6c/Bk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kJokvssE5qnyPIJBG3x029kQD6z9EGBIjKF14BYValiAkq7Sznk2jPw6N5ksfo+1XOqKWDFmAFd7DNg88sYZMj475PVQB22TKNwI6xPC9z6/4DO8SFIjnx3KkovVpqQFs5oE1GChLg9J1XC467K9rC4YnF9w5Ftc1fMYLgYP+78= 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=NohucEIa; 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="NohucEIa" ARC-Seal: i=1; a=rsa-sha256; t=1773849566; cv=none; d=zohomail.eu; s=zohoarc; b=clrOktpVdfEgqrAtplYHufBYPKEjE3DsXHFiFSsKig8P17JeRh698rPUIPQuz/u+k+NURhz6UTC5mvatqEKJFwOTQ9so6l05w+CiARAXKPddlhqmUuEB+QgeEo9PrbmhXZJb82E6dbdiDSYuDscv5Q+lGJcXuYd4ZZFJv4tyxek= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773849566; 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=cPONFxE5sSpxlOcuBEuXox3opBRCgGOE6s+csa36JdY/GgSi0ZN+KWKnKhsCrhl62U3pSAm5ec6tuOFEccgwRlQz2C3klYLhKJPfN3S/Dd2aOm6Yvz1cwpejIJwBmbulCfCZnEJU9G+D/uexhYZMUTgcXUbwK5YgZ/Aw/HCFUSs= 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=1773849566; 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=NohucEIa9HvqKwWQTd5FMwhsyV7uW440jq7Mu54cUWHtl1AnCbcDY3x4u3eo8dVl AxrMXaona35B8gosJ0bK0+HVx5DB/T2kU/GgokzUUBROiTFg+g7O8PXOghDy3uq+Boz kMXrAl/AizMsvzFlxWnleA2Ym3vvYH67BfJvZMrg= Received: by mx.zoho.eu with SMTPS id 1773849564734867.8074198038827; Wed, 18 Mar 2026 16:59:24 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v8 09/13] lib/bootconfig: fix signed comparison in xbc_node_get_data() Date: Wed, 18 Mar 2026 15:59:15 +0000 Message-Id: <20260318155919.78168-10-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318155919.78168-1-objecting@objecting.org> References: <20260318155919.78168-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 16:45:34 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 3DF77407106; Wed, 18 Mar 2026 15:59:34 +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=1773849583; cv=pass; b=jTblWM+BE5qtlxhT+tK69saRUuxH3FqmkGGIcc4kd6JWuObyVW/j2VvxXklMNPfz4CVXM5sjUp98aFd6IyoIdjEPwHM2dZRoh72IDWUrjQFO3Fw1NflxNdFVpHFodVF/hQ0VC3CRAwIuRbq2YsUMoKmBEG7Y/IO82M2O3+utnds= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773849583; c=relaxed/simple; bh=5DrGSXMEeIUOEdbJ9WiMaf2PnGRbNPGketohz92imfY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F8BRXI/0fbEXsgJtci2yXyqGBHEmS5ZKboFC171wj/RHTNXX35wX31o56Lvxt6e3eFlqSQOlxuLvomtBhmTNVyQ/Xuo2TUbqMVmlov+42AtfQIyRHYxOAlf+kaJJcx6HIwNqh4GQYbsoVXXAmMNcets+PImrZPGVEVgoaAyCWR0= 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=azdOizLL; 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="azdOizLL" ARC-Seal: i=1; a=rsa-sha256; t=1773849567; cv=none; d=zohomail.eu; s=zohoarc; b=Dg87BOQdzK+a9VeCxhMrQ9OaHifXUkWWF8H4saB3gGViZg45LbFgidRQ9ysV8ZFrIjJa1jEFfkSBXPa9/t4xRp0EsjKIH9TDETEfxMuH2LlqESRw8SEq3a6ni8w/W9j9D0hEtQz/un1N6AcUJ5wml/TXrwdgLMFxDS741FB4p2I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773849567; 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=gl6Q9bw557RzJWZvtHw/LVpU6Amkuyg2/amFZGqdnsxFzZp9ji+T7WVEPeR2pmF1NzG29Bd9s7n0WX0/DggMVlNF44adYXYFLjssNTVjYbO8zZ1i2hINDQfpnAjsR4RzTQk+ljqTU4ofdtbcoI4P0Mo1Kc4qe5RrOYeOdoRZOGQ= 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=1773849567; 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=azdOizLLNN6CsV8Y54PbWCp1oBx0xRJeFYuB7sMZYXdMrXT9Ca4of4jiXrhPioBm v/K3Ivw80ln9iEXQDDxemj4lU9fE4b7vIz0YV4hf44HOuxEybIzAbB4x6q4J0FdfN46 hXUvOz0XkOvQGkk/MOxpvZRKVFffmWrCDdZ5y9jE= Received: by mx.zoho.eu with SMTPS id 1773849565242328.5993341348583; Wed, 18 Mar 2026 16:59:25 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v8 10/13] lib/bootconfig: use size_t for strlen result in xbc_node_match_prefix() Date: Wed, 18 Mar 2026 15:59:16 +0000 Message-Id: <20260318155919.78168-11-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318155919.78168-1-objecting@objecting.org> References: <20260318155919.78168-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 16:45:34 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 677083E5569; Wed, 18 Mar 2026 15:59:34 +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=1773849581; cv=pass; b=VkNwyQvXsuZ6MACl82Ry/lae88o28kGQTDJ1SN37+EsccwLw5dPCgWf2pXDfAyEUu6CaQ7uDFS9SNh9CNmuhLZad4YtRNOEjzP+cxX9Y0mNizJ9dpsN9k9/FKdaZ4rF8sRbH0OvmDYHUuU6qxUCXaQXxbOEnPasH6uQF3Qfyfy0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773849581; c=relaxed/simple; bh=DUCDFOLJ57qkCNI68sXQsO7UVxK28h+iRY+VtUQMUrY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aXPWOOfQGuoZivF48rccv4f3Oa1WWq7+PKi7PBXy0C6DOMVXcIK457P5aSR2bf233Yt6ah7Nkz3vJTG9hg8wypbo+n/2cvX5++HJ5IELdqXk8oXfhRZLBUNUIJ3oY/hFe8fxz+j4rKXpnh5WnEde/eFmHXHH/8lSbhsIknPyHtQ= 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=YZwAac9C; 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="YZwAac9C" ARC-Seal: i=1; a=rsa-sha256; t=1773849568; cv=none; d=zohomail.eu; s=zohoarc; b=N5GPS+0PKNYXeGzXHgLaojTCzUva8DzNnIEu6RI4FVqw6Wynn1xL0y8gwY8VGTo/ObnrvTC228TP+5umjYTotvMj4c60Pu3OoK6HJDv62zqjWzb+GJDFqf5t61t76L+w5SysvPnsXPzpTd87Ry/8dAYH/accDYShF8IPQjoLhi4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773849568; 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=aj7cwpZKzqfm+BLx+Z2EGS7Ru0LFKUHIduxPp/v61yxCTfbKZHyWne4vhR19z8DrRRo7DTUJtJmzWgfP7bJU0/3wpFK2HYfX/OfUKJWzYmEB3jGfKv6TW63+rvnNvxA6vrv90pF7oyI/uxI7JbfHFKsHuaR2GYe8tmzAkiuEMrc= 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=1773849568; 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=YZwAac9Ch2zp67ZlU0JRrBBBfGloVk2SBufayXsYuAbl7AmNZMOVOHIMs95/Rypw Zs2g4LcdLe+0884AzHhLbFVc5ymM2hcUj8KSoKmK8v8qkClLl/T9b8LEDNFsnWv1/Wi TSPpIGxeWEmA1klKtJL1PYlYZ2e9XNeOmBvZycoc= Received: by mx.zoho.eu with SMTPS id 1773849565739879.7747357765327; Wed, 18 Mar 2026 16:59:25 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v8 11/13] lib/bootconfig: use signed type for offset in xbc_init_node() Date: Wed, 18 Mar 2026 15:59:17 +0000 Message-Id: <20260318155919.78168-12-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318155919.78168-1-objecting@objecting.org> References: <20260318155919.78168-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 16:45:34 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 3CBC23F23B4; Wed, 18 Mar 2026 15:59:34 +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=1773849582; cv=pass; b=Lco8rI5VSNYwb01njiMwDfHR8QlX3ySc4CZwaHMZl0ePtdwOVIWCJQrlVgsOj3WyqY2y9e1j6Rn3vZWNWpiwQWl+L719n/FSPl4wqnLkYXOvo8eFy2zaepiyqVdUjSnasfuKrxNqZ/TjOAZwO2txk0Yhl4m1emaN3QqouSdtyYs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773849582; c=relaxed/simple; bh=EqMWAUq5/avE1mG8HKfM7kQJ2gUsjJ6VbsxnUKQBLpE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WU7wKQc1mqbW8GYKaPNDmJ8I1NQGvAP5l4Uit1l4RE2J+CiqzefWGRyZib9RsSqaMZh3191VKV/8SDOYUiOpmMZsmeUB57UOhcXFc4MbF382mz73KcK+OxJ3OXGV3nQVSfilx3juByloHjQHcQ4iRAJbDbjU/OiWWjwAl97dfgQ= 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=KgrQrXDd; 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="KgrQrXDd" ARC-Seal: i=1; a=rsa-sha256; t=1773849567; cv=none; d=zohomail.eu; s=zohoarc; b=ammtEqbAkIFlbyM+FeE8LKGIKXxWYJw9CM2oTejAqYoJB+inDL8+EGeK5Hf8gyI8AeV2UdJ1mRP79uoi6VEHcVOaCTrrcci2H4JfgJjFNqPQ0FOHwgsH6ezIjii6g58+BQbRsjJFgj1zVSlx1tz0p+gzAON61OOshbRrIDtBI9I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773849567; 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=TyoHP0Vcf7gPHeizGUAIBLJNkwFfytgFPQazv9T6pkKpC0RxS5lc7F2jFUTuW25LDoYQBthU2GibkJ3UbDfny2Dx3yV9m8rSqemZ5k4AYaY19JcDH/+kdNMTzkmjjrlnp2bPkqIkbmrBiPLZLQDEVilYzXyz5s6Hy0FHMP3uDuY= 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=1773849567; 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=KgrQrXDd6Z3jWaHLlnyaNtu4Tg1qR0zvdnGmC51l4PHOY4XWjTKG/Je3qYQB1fTw 7s71SXUX61Xi/BwMj2rzBgXdANp22t4PmyJDSFkPBWBCIF23MJUs970CkphdxNXRF81 cycic6lGKvlKXJN9iy0kJ1GYYzT43x1UjMq4AkGA= Received: by mx.zoho.eu with SMTPS id 1773849566234938.1525443983288; Wed, 18 Mar 2026 16:59:26 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v8 12/13] lib/bootconfig: use size_t for key length tracking in xbc_verify_tree() Date: Wed, 18 Mar 2026 15:59:18 +0000 Message-Id: <20260318155919.78168-13-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318155919.78168-1-objecting@objecting.org> References: <20260318155919.78168-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 16:45:34 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 DE8B03F20E8; Wed, 18 Mar 2026 15:59:36 +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=1773849585; cv=pass; b=JU7mJKAHaOaqKHPZkxAMFaSTa7HGQtYeUpRzKYimKWx0NURkEfh3EOCG/EtJr2/TKfQV4+scPOcGRR/ueq5sEajOZFMmZqyR13vl9wTEAhGgNmFjQbCKvp9lt7P+2bA+eLfIwP7wHMSY/cb2vddf2BGCw3BBr3w5QkEYRwxDVMM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773849585; c=relaxed/simple; bh=7qcTi1Qw1HGoC100WqAdp0msifIJQXAc1FoFoU3K2WI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vA+rPj9+URjg07lRHn7+BSN+8tmzCmvIaCmerdnApOnFj98Z2y/mEV4w25emI9Mb6m6u+FH3JtJ9ztmCGBVF9iiHWwyBpL5QjDvmUWHB0C6t6PEWZiiaH0pLBmI8NJ4h1vdiDtynMZpmhgm0Qi6eEyAtsNHQ89OTXFel+3br8hI= 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=kaOcrLmr; 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="kaOcrLmr" ARC-Seal: i=1; a=rsa-sha256; t=1773849568; cv=none; d=zohomail.eu; s=zohoarc; b=U6YqkMO+FnPF8KmFZa519CwFE+1m+T1dvMysN8PoJTCPFAluR/wD9wKJMXBAB0hC9Nu60w+RHYLi5/56x55V9M+Ac2hBZbkKfsXsUMClWGt6jcmZLLuopAN1ZyHXctwzsElrJCxYlmLWoyqbDD4Wd/Hs/eHhMPUQMbglnGnYrxo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773849568; 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=Q8xcSNZv5JqMFwcFu6qcIiBuMl2sWY2KCKxW9P83Flijr0VOIZN7Y7BihCz1PuvzhY6I/jcFFqx7aVey31oOWE6LBAizCDx/o6Wxd6vKVTWd9jseFHqc2SiVJqakeiYUbA0D/4cTt8RlZEcg2KqWM3MPARI2Cs5UOB/JEjLnHt8= 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=1773849568; 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=kaOcrLmrqguSO6pma79TwDko4XHccY9CSEGSRsRO7j5g5D6sIYAAU2sriI5IhkBl 0ljUBrmf8Imj2BokgcItChxhZ8Lz98zNJisNhEgn6e86ktHn5AS6i2/qejGP4zjX2vv 99DXFcnB0sm5/+j5WlX3/z08e2kvuh5Y53pgtNVs= Received: by mx.zoho.eu with SMTPS id 1773849566739722.7590972969375; Wed, 18 Mar 2026 16:59:26 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Law Subject: [PATCH v8 13/13] lib/bootconfig: change xbc_node_index() return type to uint16_t Date: Wed, 18 Mar 2026 15:59:19 +0000 Message-Id: <20260318155919.78168-14-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318155919.78168-1-objecting@objecting.org> References: <20260318155919.78168-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