From: Mark Brown <broonie@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Bradley Morgan <include@grrlz.net>,
Breno Leitao <leitao@debian.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Next Mailing List <linux-next@vger.kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>
Subject: linux-next: manual merge of the mm-nonmm-unstable tree with the tip-fixes tree
Date: Thu, 2 Jul 2026 15:04:29 +0100 [thread overview]
Message-ID: <akZv7XdTZlkCUQ1L@sirena.org.uk> (raw)
[-- Attachment #1: Type: text/plain, Size: 2661 bytes --]
Hi all,
Today's linux-next merge of the mm-nonmm-unstable tree got a conflict in:
lib/bootconfig.c
between commit:
dec4d8118c179 ("bootconfig: fix NULL-pointer arithmetic in xbc_snprint_cmdline()")
from the tip-fixes tree and commit:
9f2274451ae6b ("lib/bootconfig: fix undefined behavior involving NULL pointer arithmetic")
from the mm-nonmm-unstable tree which look like two fixes for the same
issue.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
diff --combined lib/bootconfig.c
index 2ed9ee3dc81c7,c913259c80ce1..0000000000000
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@@ -427,18 -427,11 +427,18 @@@ static char xbc_namebuf[XBC_KEYLEN_MAX
int __init xbc_snprint_cmdline(char *buf, size_t size, struct xbc_node *root)
{
struct xbc_node *knode, *vnode;
- char *end = buf ? buf + size : NULL;
const char *val, *q;
size_t len = 0;
int ret;
+ /*
+ * Track the running written length rather than advancing @buf, so we
+ * never form "buf + size" or "buf += ret" while @buf is NULL (the
+ * size-probe call passes buf=NULL, size=0). NULL pointer arithmetic
+ * is undefined behavior and trips host UBSan / FORTIFY_SOURCE when
+ * this renderer runs at kernel build time. snprintf(NULL, 0, ...)
+ * itself is well defined and returns the would-be length.
+ */
xbc_node_for_each_key_value(root, knode, val) {
ret = xbc_node_compose_key_after(root, knode,
xbc_namebuf, XBC_KEYLEN_MAX);
@@@ -447,11 -440,12 +447,11 @@@
vnode = xbc_node_get_child(knode);
if (!vnode) {
- ret = snprintf(buf, rest(buf, end), "%s ", xbc_namebuf);
+ ret = snprintf(buf ? buf + len : NULL, rest(len, size),
+ "%s ", xbc_namebuf);
if (ret < 0)
return ret;
len += ret;
- if (buf)
- buf += ret;
continue;
}
xbc_array_for_each_value(vnode, val) {
@@@ -461,11 -455,13 +461,11 @@@
* whitespace.
*/
q = strpbrk(val, " \t\r\n") ? "\"" : "";
- ret = snprintf(buf, rest(buf, end), "%s=%s%s%s ",
- xbc_namebuf, q, val, q);
+ ret = snprintf(buf ? buf + len : NULL, rest(len, size),
+ "%s=%s%s%s ", xbc_namebuf, q, val, q);
if (ret < 0)
return ret;
len += ret;
- if (buf)
- buf += ret;
}
}
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next reply other threads:[~2026-07-02 14:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 14:04 Mark Brown [this message]
2026-07-02 17:28 ` linux-next: manual merge of the mm-nonmm-unstable tree with the tip-fixes tree Andrew Morton
2026-07-03 14:41 ` Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=akZv7XdTZlkCUQ1L@sirena.org.uk \
--to=broonie@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=include@grrlz.net \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=mhiramat@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox