commit: 3b50392746348d310486cd36f2067df9812990a6 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> AuthorDate: Thu Aug 15 13:19:10 2024 +0000 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> CommitDate: Thu Aug 15 13:19:10 2024 +0000 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=3b503927
tools lib subcmd: Fixed uninitialized use of variable in parse-options Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> 0000_README | 4 +++ 2901_tools-lib-subcmd-compile-fix.patch | 54 +++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/0000_README b/0000_README index 46799647..845e8cff 100644 --- a/0000_README +++ b/0000_README @@ -87,6 +87,10 @@ Patch: 2900_tmp513-Fix-build-issue-by-selecting-CONFIG_REG.patch From: https://bugs.gentoo.org/710790 Desc: tmp513 requies REGMAP_I2C to build. Select it by default in Kconfig. See bug #710790. Thanks to Phil Stracchino +Patch: 2901_tools-lib-subcmd-compile-fix.patch +From: https://lore.kernel.org/all/[email protected]/ +Desc: tools lib subcmd: Fixed uninitialized use of variable in parse-options + Patch: 2910_bfp-mark-get-entry-ip-as--maybe-unused.patch From: https://www.spinics.net/lists/stable/msg604665.html Desc: bpf: mark get_entry_ip as __maybe_unused diff --git a/2901_tools-lib-subcmd-compile-fix.patch b/2901_tools-lib-subcmd-compile-fix.patch new file mode 100644 index 00000000..bb1f7ffd --- /dev/null +++ b/2901_tools-lib-subcmd-compile-fix.patch @@ -0,0 +1,54 @@ +From git@z Thu Jan 1 00:00:00 1970 +Subject: [PATCH] tools lib subcmd: Fixed uninitialized use of variable in + parse-options +From: Michael Weiß <[email protected]> +Date: Wed, 31 Jul 2024 10:52:17 +0200 +Message-Id: <[email protected]> +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Since commit ea558c86248b ("tools lib subcmd: Show parent options in +help"), our debug images fail to build. + +For our Yocto-based GyroidOS, we build debug images with debugging enabled +for all binaries including the kernel. Yocto passes the corresponding gcc +option "-Og" also to the kernel HOSTCFLAGS. This results in the following +build error: + + parse-options.c: In function ‘options__order’: + parse-options.c:834:9: error: ‘o’ may be used uninitialized [-Werror=maybe-uninitialized] + 834 | memcpy(&ordered[nr_opts], o, sizeof(*o)); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + parse-options.c:812:30: note: ‘o’ was declared here + 812 | const struct option *o, *p = opts; + | ^ + .. + +Fix it by initializing 'o' instead of 'p' in the above failing line 812. +'p' is initialized afterwards in the following for-loop anyway. +I think that was the intention of the commit ea558c86248b ("tools lib +subcmd: Show parent options in help") in the first place. + +Fixes: ea558c86248b ("tools lib subcmd: Show parent options in help") +Signed-off-by: Michael Weiß <[email protected]> +--- + tools/lib/subcmd/parse-options.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c +index 4b60ec03b0bb..2a3b51a690c7 100644 +--- a/tools/lib/subcmd/parse-options.c ++++ b/tools/lib/subcmd/parse-options.c +@@ -809,7 +809,7 @@ static int option__cmp(const void *va, const void *vb) + static struct option *options__order(const struct option *opts) + { + int nr_opts = 0, nr_group = 0, nr_parent = 0, len; +- const struct option *o, *p = opts; ++ const struct option *o = opts, *p; + struct option *opt, *ordered = NULL, *group; + + /* flatten the options that have parents */ +-- +2.39.2 +
