From f83b46baf98d276f5f84fa84c8b461f412ac1f5e Mon Sep 17 00:00:00 2001 From: Paul Dagnelie Date: Tue, 19 Apr 2016 16:36:10 -0700 Subject: 6872 zfs libraries should not allow uninitialized variables Reviewed by: Dan Kimmel Reviewed by: George Wilson Reviewed by: Prakash Surya Reviewed by: Yuri Pankov Approved by: Robert Mustacchi --- usr/src/lib/libzfs/common/libzfs_dataset.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'usr/src/lib/libzfs/common/libzfs_dataset.c') diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c index 71a2226fef..e72d0e8d00 100644 --- a/usr/src/lib/libzfs/common/libzfs_dataset.c +++ b/usr/src/lib/libzfs/common/libzfs_dataset.c @@ -1546,7 +1546,7 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props) libzfs_handle_t *hdl = zhp->zfs_hdl; nvlist_t *nvl; int nvl_len; - int added_resv; + int added_resv = 0; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot set property for '%s'"), @@ -3140,7 +3140,7 @@ zfs_create_ancestors(libzfs_handle_t *hdl, const char *path) { int prefix; char *path_copy; - int rc; + int rc = 0; if (check_parents(hdl, path, NULL, B_TRUE, &prefix) != 0) return (-1); @@ -3779,7 +3779,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, boolean_t force) rollback_data_t cb = { 0 }; int err; boolean_t restore_resv = 0; - uint64_t old_volsize, new_volsize; + uint64_t old_volsize = 0, new_volsize; zfs_prop_t resv_prop; assert(zhp->zfs_type == ZFS_TYPE_FILESYSTEM || @@ -3968,6 +3968,7 @@ zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive, "child dataset with inherited mountpoint is used " "in a non-global zone")); (void) zfs_error(hdl, EZFS_ZONED, errbuf); + ret = -1; goto error; } -- cgit v1.2.3