From c40db193a5e503fffacf6d96a7dd48a0f1b36601 Mon Sep 17 00:00:00 2001 From: GeLiXin Date: Thu, 25 Aug 2016 16:40:20 +0800 Subject: [PATCH] Fix: Build warnings with different gcc optimization levels in debug mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fix resolves warnings reported during compiling with different gcc optimization levels in debug mode, Test tools: gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) Linux version: 2.6.32-573.18.1.el6.x86_64, Red Hat Enterprise Linux Server release 6.1 (Santiago) List of warnings: CFLAGS=-O1 ./configure --enable-debug ;make ../../module/icp/core/kcf_sched.c: In function ‘kcf_aop_done’: ../../module/icp/core/kcf_sched.c:499: error: ‘fg’ may be used uninitialized in this function ../../module/icp/core/kcf_sched.c:499: note: ‘fg’ was declared here CFLAGS=-Os ./configure --enable-debug ; make libzfs_dataset.c: In function ‘zfs_prop_set_list’: libzfs_dataset.c:1575: error: ‘nvl_len’ may be used uninitialized in this function Signed-off-by: GeLiXin Signed-off-by: Brian Behlendorf Closes #5022 --- lib/libzfs/libzfs_dataset.c | 3 +-- module/icp/core/kcf_sched.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) mode change 100644 => 100755 lib/libzfs/libzfs_dataset.c mode change 100644 => 100755 module/icp/core/kcf_sched.c diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c old mode 100644 new mode 100755 index 794d35fbe3..bd90bf0bf5 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -1572,7 +1572,7 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props) char errbuf[1024]; libzfs_handle_t *hdl = zhp->zfs_hdl; nvlist_t *nvl; - int nvl_len; + int nvl_len = 0; int added_resv = 0; zfs_prop_t prop = 0; nvpair_t *elem; @@ -1602,7 +1602,6 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props) * Check how many properties we're setting and allocate an array to * store changelist pointers for postfix(). */ - nvl_len = 0; for (elem = nvlist_next_nvpair(nvl, NULL); elem != NULL; elem = nvlist_next_nvpair(nvl, elem)) diff --git a/module/icp/core/kcf_sched.c b/module/icp/core/kcf_sched.c old mode 100644 new mode 100755 index 8102d6675f..7046495f4d --- a/module/icp/core/kcf_sched.c +++ b/module/icp/core/kcf_sched.c @@ -496,7 +496,7 @@ kcf_resubmit_request(kcf_areq_node_t *areq) kcf_provider_desc_t *new_pd; crypto_mechanism_t *mech1 = NULL, *mech2 = NULL; crypto_mech_type_t prov_mt1, prov_mt2; - crypto_func_group_t fg; + crypto_func_group_t fg = 0; if (!can_resubmit(areq, &mech1, &mech2, &fg)) return (error);