babeltrace2: initialize the other_entry pointer
PATCH 1/1 babeltrace2: initialize the other_entry pointer
From: Mingli Yu <[email protected]>
When add below line to local.conf to enable debug build:
DEBUG_BUILD = "1"
There comes below failure when run "bitbake babeltrace2"
| ../../../../../git/src/plugins/ctf/fs-src/fs.c: In function 'ds_index_insert_ds_index_entry_sorted':
| ../../../../../git/src/plugins/ctf/fs-src/fs.c:702:5: error: 'other_entry' may be used uninitialized in this function [-Werror=maybe-uninitialized]
| 702 | !ds_index_entries_equal(entry, other_entry)) {So initialize the other_entry pointer to fix the above error.
--- .../0001-fs.c-initialize-other_entry.patch | 33 ++++++++++++++++++++++ meta/recipes-kernel/lttng/babeltrace2_2.0.1.bb | 1 + 2 files changed, 34 insertions(+) create mode 100644 meta/recipes-kernel/lttng/babeltrace2/0001-fs.c-initialize-other_entry.patch
meta/recipes-kernel/lttng/babeltrace2/0001-fs.c-initialize-other_entry.patch new file +33 -0
@@ -0,0 +1,33 @@ +From 42dae692b9057d03ce9a0651f061472e9dd90130 Mon Sep 17 00:00:00 2001 +From: Mingli Yu <[email protected]> +Date: Wed, 11 Mar 2020 08:44:42 +0000 +Subject: [PATCH] fs.c: initialize the other_entry variable + +Initialize the pointer other_entry to fix the below error: +| ../../../../../git/src/plugins/ctf/fs-src/fs.c: In function 'ds_index_insert_ds_index_entry_sorted': +| ../../../../../git/src/plugins/ctf/fs-src/fs.c:702:5: error: 'other_entry' may be used uninitialized in this function [-Werror=maybe-uninitialized] +| 702 | !ds_index_entries_equal(entry, other_entry)) { + +Upstream-Status: Submitted [https://lists.lttng.org/pipermail/lttng-dev/2020-March/029549.html] + +Signed-off-by: Mingli Yu <[email protected]> +--- + src/plugins/ctf/fs-src/fs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/plugins/ctf/fs-src/fs.c b/src/plugins/ctf/fs-src/fs.c +index e87523a3..a6b5315f 100644 +--- a/src/plugins/ctf/fs-src/fs.c ++++ b/src/plugins/ctf/fs-src/fs.c +@@ -680,7 +680,7 @@ void ds_index_insert_ds_index_entry_sorted( + struct ctf_fs_ds_index_entry *entry) + { + guint i; +- struct ctf_fs_ds_index_entry *other_entry; ++ struct ctf_fs_ds_index_entry *other_entry = NULL; + + /* Find the spot where to insert this index entry. */ + for (i = 0; i < index->entries->len; i++) { +-- +2.24.1 +
meta/recipes-kernel/lttng/babeltrace2_2.0.1.bb +1 -0
@@ -10,6 +10,7 @@ DEPENDS = "glib-2.0 util-linux popt bison-native flex-native" SRC_URI = "git://git.linuxfoundation.org/diamon/babeltrace.git;branch=stable-2.0 \ file://run-ptest \ file://0001-tests-do-not-run-test-applications-from-.libs.patch \ + file://0001-fs.c-initialize-other_entry.patch \ " SRCREV = "06df58f89ee51b1a2c6a2c187ec3f15691633910" UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>2(\.\d+)+)$"
Signature · 1 line
2.7.4
Hi Mingli,
Thanks for also posting this on the lttng-dev mailing list. I'm sure we can get this in fairly quickly upstream.
This is more a question for Richard and other core members of oe, is this kind of patch pertinent for upstream oe considering it is only silencing a warning (based on [1])?
[1] https://lists.lttng.org/pipermail/lttng-dev/2020-March/029550.html
Quoted 79 lines · On Wed, Mar 11, 2020 at 09:49:33PM +0800, [email protected] wrote:
From: Mingli Yu <[email protected]>
When add below line to local.conf to enable debug build:
DEBUG_BUILD= "1"There comes below failure when run "bitbake babeltrace2"
| ../../../../../git/src/plugins/ctf/fs-src/fs.c: In function 'ds_index_insert_ds_index_entry_sorted': | ../../../../../git/src/plugins/ctf/fs-src/fs.c:702:5: error: 'other_entry' may be used uninitialized in this function [-Werror=maybe-uninitialized] | 702 | !ds_index_entries_equal(entry, other_entry)) {So initialize the
other_entrypointer to fix the above error.Signed-off-by Mingli Yu <[email protected]>--- .../0001-fs.c-initialize-other_entry.patch | 33 ++++++++++++++++++++++ meta/recipes-kernel/lttng/babeltrace2_2.0.1.bb | 1 + 2 files changed, 34 insertions(+) create mode 100644 meta/recipes-kernel/lttng/babeltrace2/0001-fs.c-initialize-other_entry.patchmeta/recipes-kernel/lttng/babeltrace2/0001-fs.c-initialize-other_entry.patch new file +33
-0@@ -0,0 +1,33 @@ +From 42dae692b9057d03ce9a0651f061472e9dd90130 Mon Sep 17 00:00:00 2001 +From: Mingli Yu <[email protected]> +Date: Wed, 11 Mar 2020 08:44:42 +0000 +Subject: [PATCH] fs.c: initialize the other_entry variable + +Initialize the pointer other_entry to fix the below error: +| ../../../../../git/src/plugins/ctf/fs-src/fs.c: In function 'ds_index_insert_ds_index_entry_sorted': +| ../../../../../git/src/plugins/ctf/fs-src/fs.c:702:5: error: 'other_entry' may be used uninitialized in this function [-Werror=maybe-uninitialized] +| 702 | !ds_index_entries_equal(entry, other_entry)) { + +Upstream-Status: Submitted [https://lists.lttng.org/pipermail/lttng-dev/2020-March/029549.html] + +Signed-off-by: Mingli Yu <[email protected]> +--- + src/plugins/ctf/fs-src/fs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/plugins/ctf/fs-src/fs.c b/src/plugins/ctf/fs-src/fs.c +index e87523a3..a6b5315f 100644 +--- a/src/plugins/ctf/fs-src/fs.c ++++ b/src/plugins/ctf/fs-src/fs.c +@@ -680,7 +680,7 @@ void ds_index_insert_ds_index_entry_sorted( + struct ctf_fs_ds_index_entry *entry) + { + guint i; +- struct ctf_fs_ds_index_entry *other_entry; ++ struct ctf_fs_ds_index_entry *other_entry = NULL; + + /* Find the spot where to insert this index entry. */ + for (i = 0; i < index->entries->len; i++) { +-- +2.24.1 +meta/recipes-kernel/lttng/babeltrace2_2.0.1.bb +1
-0@@ -10,6 +10,7 @@ DEPENDS = "glib-2.0 util-linux popt bison-native flex-native" SRC_URI = "git://git.linuxfoundation.org/diamon/babeltrace.git;branch=stable-2.0 \ file://run-ptest \ file://0001-tests-do-not-run-test-applications-from-.libs.patch \ + file://0001-fs.c-initialize-other_entry.patch \ " SRCREV = "06df58f89ee51b1a2c6a2c187ec3f15691633910" UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>2(\.\d+)+)$"Signature · 7 lines
2.7.4 -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 2 lines
Jonathan Rajotte-Julien EfficiOS
Quoted 6 lines · Jonathan Rajotte-Julien
Hi Mingli,
Thanks for also posting this on the lttng-dev mailing list. I'm sure we can get
this in fairly quickly upstream.
Quoted 6 lines
This is more a question for Richard and other core members of oe, is this kind of patch pertinent for upstream oe considering it is only silencing a warning (based on [1])?
[1]
https://lists.lttng.org/pipermail/lttng-dev/2020-March/029550.html
I took it based on the fact it was submitted upstream and I thought it was fixing some kind potential data init issue. If it is just a compiler warning then my opinion of it at this point in the release cycle would be quite different. It does show the importance of commit descriptions.
It was tested and merged so I'll leave it but you make some good points.
Cheers,
Richard