From 22083501be971f78586ff23f1f89cdcf5b6e6457 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 20 Nov 2008 14:04:00 -0800 Subject: [PATCH] Add gcc-uninit branch --- .topdeps | 1 + .topmsg | 8 ++++++++ zfs/lib/libzcommon/compress.c | 4 ++-- zfs/lib/libzfs/libzfs_dataset.c | 5 +++-- zfs/lib/libzpool/arc.c | 9 +++++---- zfs/lib/libzpool/dsl_dataset.c | 2 +- zfs/lib/libzpool/lzjb.c | 4 ++-- zfs/lib/libzpool/refcount.c | 2 +- zfs/lib/libzpool/spa.c | 6 +++--- zfs/lib/libzpool/vdev_raidz.c | 2 +- zfs/lib/libzpool/zap_leaf.c | 2 +- zfs/lib/libzpool/zfs_byteswap.c | 2 +- 12 files changed, 29 insertions(+), 18 deletions(-) create mode 100644 .topdeps create mode 100644 .topmsg diff --git a/.topdeps b/.topdeps new file mode 100644 index 0000000000..1f7391f92b --- /dev/null +++ b/.topdeps @@ -0,0 +1 @@ +master diff --git a/.topmsg b/.topmsg new file mode 100644 index 0000000000..d0f48aca13 --- /dev/null +++ b/.topmsg @@ -0,0 +1,8 @@ +From: Brian Behlendorf +Subject: [PATCH] gcc warning uninitialized variable + +Gcc -Wall warn: 'uninitialized variable' + +Signed-off-by: Brian Behlendorf + +--- diff --git a/zfs/lib/libzcommon/compress.c b/zfs/lib/libzcommon/compress.c index 4bf55ba16c..c164e59531 100644 --- a/zfs/lib/libzcommon/compress.c +++ b/zfs/lib/libzcommon/compress.c @@ -130,7 +130,7 @@ compress(void *s_start, void *d_start, size_t s_len) { uchar_t *src = s_start; uchar_t *dst = d_start; - uchar_t *cpy, *copymap; + uchar_t *cpy, *copymap = NULL; int copymask = 1 << (NBBY - 1); int mlen, offset; uint16_t *hp; @@ -181,7 +181,7 @@ decompress(void *s_start, void *d_start, size_t s_len, size_t d_len) uchar_t *dst = d_start; uchar_t *s_end = (uchar_t *)s_start + s_len; uchar_t *d_end = (uchar_t *)d_start + d_len; - uchar_t *cpy, copymap; + uchar_t *cpy, copymap = 0; int copymask = 1 << (NBBY - 1); if (s_len >= d_len) { diff --git a/zfs/lib/libzfs/libzfs_dataset.c b/zfs/lib/libzfs/libzfs_dataset.c index 5b8119209c..99afd57b27 100644 --- a/zfs/lib/libzfs/libzfs_dataset.c +++ b/zfs/lib/libzfs/libzfs_dataset.c @@ -1048,7 +1048,7 @@ zfs_build_perms(zfs_handle_t *zhp, char *whostr, char *perms, nvlist_t *perms_nvp = NULL; nvlist_t *sets_nvp = NULL; char errbuf[1024]; - char *who_tok, *perm; + char *who_tok = NULL, *perm; int error; *nvp = NULL; @@ -3523,7 +3523,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, boolean_t force) int err; zfs_cmd_t zc = { 0 }; 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 || @@ -3774,6 +3774,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; } diff --git a/zfs/lib/libzpool/arc.c b/zfs/lib/libzpool/arc.c index 8d091b7cea..2adfc2c8d1 100644 --- a/zfs/lib/libzpool/arc.c +++ b/zfs/lib/libzpool/arc.c @@ -2393,7 +2393,7 @@ arc_read(zio_t *pio, spa_t *spa, blkptr_t *bp, arc_byteswap_func_t *swap, uint32_t *arc_flags, zbookmark_t *zb) { arc_buf_hdr_t *hdr; - arc_buf_t *buf; + arc_buf_t *buf = NULL; kmutex_t *hash_lock; zio_t *rzio; @@ -2767,7 +2767,7 @@ arc_release(arc_buf_t *buf, void *tag) arc_buf_hdr_t *hdr = buf->b_hdr; kmutex_t *hash_lock = HDR_LOCK(hdr); l2arc_buf_hdr_t *l2hdr = NULL; - uint64_t buf_size; + uint64_t buf_size = 0; /* this buffer is not on any list */ ASSERT(refcount_count(&hdr->b_refcnt) > 0); @@ -3683,7 +3683,7 @@ l2arc_read_done(zio_t *zio) static list_t * l2arc_list_locked(int list_num, kmutex_t **lock) { - list_t *list; + list_t *list = NULL; ASSERT(list_num >= 0 && list_num <= 3); @@ -3860,10 +3860,11 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev) uint64_t target_sz = dev->l2ad_write; uint64_t headroom = dev->l2ad_write * l2arc_headroom; void *buf_data; - kmutex_t *hash_lock, *list_lock; + kmutex_t *hash_lock, *list_lock = NULL; boolean_t have_lock, full; l2arc_write_callback_t *cb; zio_t *pio, *wzio; + int try; ASSERT(MUTEX_HELD(&l2arc_dev_mtx)); ASSERT(dev->l2ad_vdev != NULL); diff --git a/zfs/lib/libzpool/dsl_dataset.c b/zfs/lib/libzpool/dsl_dataset.c index 88a280d676..737c271f5d 100644 --- a/zfs/lib/libzpool/dsl_dataset.c +++ b/zfs/lib/libzpool/dsl_dataset.c @@ -345,7 +345,7 @@ dsl_dataset_open_obj(dsl_pool_t *dp, uint64_t dsobj, const char *snapname, return (err); ds = dmu_buf_get_user(dbuf); if (ds == NULL) { - dsl_dataset_t *winner; + dsl_dataset_t *winner = NULL; ds = kmem_zalloc(sizeof (dsl_dataset_t), KM_SLEEP); ds->ds_dbuf = dbuf; diff --git a/zfs/lib/libzpool/lzjb.c b/zfs/lib/libzpool/lzjb.c index 22f9c2b1ba..b83f4537a1 100644 --- a/zfs/lib/libzpool/lzjb.c +++ b/zfs/lib/libzpool/lzjb.c @@ -51,7 +51,7 @@ lzjb_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) { uchar_t *src = s_start; uchar_t *dst = d_start; - uchar_t *cpy, *copymap; + uchar_t *cpy, *copymap = NULL; int copymask = 1 << (NBBY - 1); int mlen, offset; uint16_t *hp; @@ -104,7 +104,7 @@ lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) uchar_t *src = s_start; uchar_t *dst = d_start; uchar_t *d_end = (uchar_t *)d_start + d_len; - uchar_t *cpy, copymap; + uchar_t *cpy, copymap = 0; int copymask = 1 << (NBBY - 1); while (dst < d_end) { diff --git a/zfs/lib/libzpool/refcount.c b/zfs/lib/libzpool/refcount.c index d192394f8f..693af2f83a 100644 --- a/zfs/lib/libzpool/refcount.c +++ b/zfs/lib/libzpool/refcount.c @@ -113,7 +113,7 @@ refcount_count(refcount_t *rc) int64_t refcount_add_many(refcount_t *rc, uint64_t number, void *holder) { - reference_t *ref; + reference_t *ref = NULL; int64_t count; if (reference_tracking_enable) { diff --git a/zfs/lib/libzpool/spa.c b/zfs/lib/libzpool/spa.c index f59db06db7..136d0874ea 100644 --- a/zfs/lib/libzpool/spa.c +++ b/zfs/lib/libzpool/spa.c @@ -272,7 +272,7 @@ spa_prop_validate(spa_t *spa, nvlist_t *props) { nvpair_t *elem; int error = 0, reset_bootfs = 0; - uint64_t objnum; + uint64_t objnum = 0; elem = NULL; while ((elem = nvlist_next_nvpair(props, elem)) != NULL) { @@ -800,7 +800,7 @@ spa_load_l2cache(spa_t *spa) uint_t nl2cache; int i, j, oldnvdevs; uint64_t guid; - vdev_t *vd, **oldvdevs, **newvdevs; + vdev_t *vd, **oldvdevs, **newvdevs = NULL; spa_aux_vdev_t *sav = &spa->spa_l2cache; if (sav->sav_config != NULL) { @@ -2827,7 +2827,7 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, int replace_done) vdev_t *rvd = spa->spa_root_vdev; vdev_t *vd, *pvd, *cvd, *tvd; boolean_t unspare = B_FALSE; - uint64_t unspare_guid; + uint64_t unspare_guid = 0; txg = spa_vdev_enter(spa); diff --git a/zfs/lib/libzpool/vdev_raidz.c b/zfs/lib/libzpool/vdev_raidz.c index cb399f046a..4de8df8a87 100644 --- a/zfs/lib/libzpool/vdev_raidz.c +++ b/zfs/lib/libzpool/vdev_raidz.c @@ -789,7 +789,7 @@ vdev_raidz_io_done(zio_t *zio) vdev_t *vd = zio->io_vd; vdev_t *cvd; raidz_map_t *rm = zio->io_vsd; - raidz_col_t *rc, *rc1; + raidz_col_t *rc = NULL, *rc1; int unexpected_errors = 0; int parity_errors = 0; int parity_untried = 0; diff --git a/zfs/lib/libzpool/zap_leaf.c b/zfs/lib/libzpool/zap_leaf.c index 132b7af626..d4c804c30e 100644 --- a/zfs/lib/libzpool/zap_leaf.c +++ b/zfs/lib/libzpool/zap_leaf.c @@ -220,7 +220,7 @@ zap_leaf_array_create(zap_leaf_t *l, const char *buf, uint16_t chunk_head; uint16_t *chunkp = &chunk_head; int byten = 0; - uint64_t value; + uint64_t value = 0; int shift = (integer_size-1)*8; int len = num_integers; diff --git a/zfs/lib/libzpool/zfs_byteswap.c b/zfs/lib/libzpool/zfs_byteswap.c index 2e98f84bbb..18d7b6e756 100644 --- a/zfs/lib/libzpool/zfs_byteswap.c +++ b/zfs/lib/libzpool/zfs_byteswap.c @@ -52,7 +52,7 @@ zfs_ace_byteswap(void *buf, size_t size, boolean_t zfs_layout) { caddr_t end; caddr_t ptr; - zfs_ace_t *zacep; + zfs_ace_t *zacep = NULL; ace_t *acep; uint16_t entry_type; size_t entry_size;