Skip to contentSkip to conversation

lib-bootconfig-fix-snprintf-truncation-check-in-xbc_node_compose_key_after.patch removed from -mm tree

merged Andrew Morton 1 participant 1 message Mar 14

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: lib/bootconfig: fix snprintf truncation check in xbc_node_compose_key_after()
has been removed from the -mm tree. Its filename was
lib-bootconfig-fix-snprintf-truncation-check-in-xbc_node_compose_key_after.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Josh Law <[email protected]>
Subject: lib/bootconfig: fix snprintf truncation check in xbc_node_compose_key_after()
Date: Thu, 12 Mar 2026 19:11:43 +0000

snprintf() returns the number of characters that would have been written excluding the NUL terminator. Output is truncated when the return value is >= the buffer size, not just > the buffer size.

When ret == size, the current code takes the non-truncated path, advancing buf by ret and reducing size to 0. This is wrong because the output was actually truncated (the last character was replaced by NUL). Fix by using

Quoted 1 line

= so the truncation path is taken correctly.

---

 lib/bootconfig.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bootconfig.c renamed from lib/bootconfig.c~lib-bootconfig-fix-snprintf-truncation-check-in-xbc_node_compose_key_after +1 -1
@@ -316,7 +316,7 @@ int __init xbc_node_compose_key_after(st
 			       depth ? "." : "");
 		if (ret < 0)
 			return ret;
-		if (ret > size) {
+		if (ret >= size) {
 			size = 0;
 		} else {
 			size -= ret;

_

Patches currently in -mm which might be from [email protected] are

lib-maple_tree-fix-swapped-arguments-in-mas_safe_pivot-call.patch lib-glob-fix-grammar-and-replace-non-inclusive-terminology.patch lib-glob-add-explicit-include-for-exporth.patch lib-glob-replace-bitwise-or-with-logical-operation-on-boolean.patch lib-glob-clean-up-bool-abuse-in-pointer-arithmetic.patch lib-uuid-fix-typo-reversion-to-revision-in-comment.patch lib-inflate-fix-memory-leak-in-inflate_fixed-on-inflate_codes-failure.patch lib-inflate-fix-memory-leak-in-inflate_dynamic-on-inflate_codes-failure.patch lib-inflate-fix-grammar-in-comment-variable-to-variables.patch lib-inflate-fix-typo-this-results-to-the-results-in-comment.patch lib-bug-fix-inconsistent-capitalization-in-bug-message.patch lib-bug-remove-unnecessary-variable-initializations.patch lib-idr-fix-ida_find_first_range-missing-ids-across-chunk-boundaries.patch lib-decompress_bunzip2-fix-32-bit-shift-undefined-behavior.patch lib-ts_bm-fix-integer-overflow-in-pattern-length-calculation.patch lib-ts_kmp-fix-integer-overflow-in-pattern-length-calculation.patch lib-glob-initialize-back_str-to-silence-uninitialized-variable-warning.patch