diff options
| author | Li Wang <li.wang@windriver.com> | 2023-11-27 14:54:47 +0800 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2023-12-02 16:36:57 -1000 |
| commit | 3e73216a32a2b01916eb8c555a41579bd69a47aa (patch) | |
| tree | 334ab258535e9627fe0688e4b0fdd9083a55cef1 | |
| parent | 239bf770b69e32e3dbedf617ef2c9d4e94c723d0 (diff) | |
| download | poky-3e73216a32a2b01916eb8c555a41579bd69a47aa.tar.gz | |
systemtap_git: fix used uninitialized error
bpf-translate.cxx: error: 'this_column_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
bpf-translate.cxx: error: 'num' may be used uninitialized in this function [-Werror=maybe-uninitialized]
(From OE-Core rev: 11da43b58e19583a9bc16044309610cfb2e86469)
Signed-off-by: Li Wang <li.wang@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-kernel/systemtap/systemtap/0001-bpf-translate.cxx-Prevent-Werror-maybe-uninitialized.patch | 53 | ||||
| -rw-r--r-- | meta/recipes-kernel/systemtap/systemtap_git.bb | 1 |
2 files changed, 54 insertions, 0 deletions
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-bpf-translate.cxx-Prevent-Werror-maybe-uninitialized.patch b/meta/recipes-kernel/systemtap/systemtap/0001-bpf-translate.cxx-Prevent-Werror-maybe-uninitialized.patch new file mode 100644 index 0000000000..130eefab5d --- /dev/null +++ b/meta/recipes-kernel/systemtap/systemtap/0001-bpf-translate.cxx-Prevent-Werror-maybe-uninitialized.patch | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | From df3425f51a512f65522522daf1f78c7fab0a63fd Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Aaron Merey <amerey@redhat.com> | ||
| 3 | Date: Fri, 25 Feb 2022 19:18:29 -0500 | ||
| 4 | Subject: [PATCH] bpf-translate.cxx: Prevent -Werror=maybe-uninitialized | ||
| 5 | |||
| 6 | Two variables in bpf-translate.cxx can trigger -Werror=maybe-uninitialized. | ||
| 7 | The code is designed so that uninitialized uses are not actually possible, | ||
| 8 | but to convince gcc of this we move a throw statement and initialize one | ||
| 9 | of the variables with a value. | ||
| 10 | |||
| 11 | Upstream-Status: Backport [https://sourceware.org/git/?p=systemtap.git;a=commit;h=df3425f51a512f65522522daf1f78c7fab0a63fd] | ||
| 12 | |||
| 13 | Signed-off-by: Li Wang <li.wang@windriver.com> | ||
| 14 | --- | ||
| 15 | bpf-translate.cxx | 8 +++++--- | ||
| 16 | 1 file changed, 5 insertions(+), 3 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/bpf-translate.cxx b/bpf-translate.cxx | ||
| 19 | index 3f45c721f..1b63d6078 100644 | ||
| 20 | --- a/bpf-translate.cxx | ||
| 21 | +++ b/bpf-translate.cxx | ||
| 22 | @@ -1203,7 +1203,7 @@ bpf_unparser::emit_asm_arg (const asm_stmt &stmt, const std::string &arg, | ||
| 23 | { | ||
| 24 | /* arg is a register number */ | ||
| 25 | std::string reg = arg[0] == 'r' ? arg.substr(1) : arg; | ||
| 26 | - unsigned long num; | ||
| 27 | + unsigned long num = ULONG_MAX; | ||
| 28 | bool parsed = false; | ||
| 29 | try { | ||
| 30 | num = stoul(reg, 0, 0); | ||
| 31 | @@ -1941,8 +1941,6 @@ bpf_unparser::visit_foreach_loop(foreach_loop* s) | ||
| 32 | for (unsigned k = 0; k < arraydecl->index_types.size(); k++) | ||
| 33 | { | ||
| 34 | auto type = arraydecl->index_types[k]; | ||
| 35 | - if (type != pe_long && type != pe_string) | ||
| 36 | - throw SEMANTIC_ERROR(_("unhandled foreach index type"), s->tok); | ||
| 37 | int this_column_size; | ||
| 38 | // PR23875: foreach should handle string keys | ||
| 39 | if (type == pe_long) | ||
| 40 | @@ -1953,6 +1951,10 @@ bpf_unparser::visit_foreach_loop(foreach_loop* s) | ||
| 41 | { | ||
| 42 | this_column_size = BPF_MAXSTRINGLEN; | ||
| 43 | } | ||
| 44 | + else | ||
| 45 | + { | ||
| 46 | + throw SEMANTIC_ERROR(_("unhandled foreach index type"), s->tok); | ||
| 47 | + } | ||
| 48 | if (info.sort_column == k + 1) // record sort column | ||
| 49 | { | ||
| 50 | info.sort_column_size = this_column_size; | ||
| 51 | -- | ||
| 52 | 2.25.1 | ||
| 53 | |||
diff --git a/meta/recipes-kernel/systemtap/systemtap_git.bb b/meta/recipes-kernel/systemtap/systemtap_git.bb index ce86d5274d..c84fc27001 100644 --- a/meta/recipes-kernel/systemtap/systemtap_git.bb +++ b/meta/recipes-kernel/systemtap/systemtap_git.bb | |||
| @@ -9,6 +9,7 @@ require systemtap_git.inc | |||
| 9 | SRC_URI += "file://0001-improve-reproducibility-for-c-compiling.patch \ | 9 | SRC_URI += "file://0001-improve-reproducibility-for-c-compiling.patch \ |
| 10 | file://0001-staprun-address-ncurses-6.3-failures.patch \ | 10 | file://0001-staprun-address-ncurses-6.3-failures.patch \ |
| 11 | file://0001-gcc12-c-compatibility-re-tweak-for-rhel6-use-functio.patch \ | 11 | file://0001-gcc12-c-compatibility-re-tweak-for-rhel6-use-functio.patch \ |
| 12 | file://0001-bpf-translate.cxx-Prevent-Werror-maybe-uninitialized.patch \ | ||
| 12 | " | 13 | " |
| 13 | 14 | ||
| 14 | DEPENDS = "elfutils" | 15 | DEPENDS = "elfutils" |
