From 19d0adfb0b79f9751297ef92c3da8312416ada90 Mon Sep 17 00:00:00 2001 From: lingsheng Date: Tue, 26 Jan 2021 09:58:18 +0800 Subject: [PATCH] Initialize child_idx to fix warning --- Initialize-child_idx.patch | 43 ++++++++++++++++++++++++++++++++++++++ nvml.spec | 6 +++++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 Initialize-child_idx.patch diff --git a/Initialize-child_idx.patch b/Initialize-child_idx.patch new file mode 100644 index 0000000..b9cb4bb --- /dev/null +++ b/Initialize-child_idx.patch @@ -0,0 +1,43 @@ +From 721a48e5397bd4ab454482041e55671eae7b189f Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 11 May 2020 18:01:11 -0700 +Subject: [PATCH] examples: Initialize child_idx + +Assign UINT_MAX and assert it + +Fixes warning +rtree_map.c:358:12: error: 'child_idx' may be used uninitialized +in this function [-Werror=maybe-uninitialized] + +Signed-off-by: Khem Raj +--- + src/examples/libpmemobj/tree_map/rtree_map.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/examples/libpmemobj/tree_map/rtree_map.c b/src/examples/libpmemobj/tree_map/rtree_map.c +index 995e22bb94..6b3ead65c2 100644 +--- a/src/examples/libpmemobj/tree_map/rtree_map.c ++++ b/src/examples/libpmemobj/tree_map/rtree_map.c +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -320,12 +321,13 @@ has_only_one_child(TOID(struct tree_map_node) node, unsigned *child_idx) + static void + remove_extra_node(TOID(struct tree_map_node) *node) + { +- unsigned child_idx; ++ unsigned child_idx = UINT_MAX; + TOID(struct tree_map_node) tmp, tmp_child; + + /* Our node has child with only one child. */ + tmp = *node; + has_only_one_child(tmp, &child_idx); ++ assert(child_idx != UINT_MAX); + tmp_child = D_RO(tmp)->slots[child_idx]; + + /* diff --git a/nvml.spec b/nvml.spec index 59a9754..4bbe007 100644 --- a/nvml.spec +++ b/nvml.spec @@ -7,7 +7,7 @@ Name: nvml Summary: Persistent Memory Development Kit (formerly NVML) Version: 1.4.2 -Release: 4 +Release: 5 License: BSD URL: http://pmem.io/pmdk @@ -90,6 +90,7 @@ Provides: librpmem-debug = %{version}-%{release} Patch0000: fix-build-error.patch Patch0001: delete-extra-tests.patch +Patch0002: Initialize-child_idx.patch %description The Persistent Memory Development Kit (PMDK), formerly known as NVML, is @@ -247,6 +248,9 @@ echo "PMEM_FS_DIR_FORCE_PMEM=1" >> src/test/testconfig.sh %endif %changelog +* Mon Jan 25 2021 lingsheng - 1.4.2-5 +- Initialize child_idx to fix warning + * Wed Aug 19 2020 lingsheng - 1.4.2-4 - Disable check