aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2010-08-26 09:58:04 -0700
committerBrian Behlendorf <[email protected]>2010-08-31 08:38:43 -0700
commitd4ed667343c3dac114642b9f6cb4f7baa3ff7334 (patch)
tree16b3f627625f83d0214446fb6f867e100f1a34c5 /module/zfs
parent1fde1e37208c2f56c72c70a06676676f04b65998 (diff)
Fix gcc uninitialized variable warnings
Gcc -Wall warn: 'uninitialized variable' Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/arc.c10
-rw-r--r--module/zfs/dmu.c2
-rw-r--r--module/zfs/dmu_objset.c2
-rw-r--r--module/zfs/dsl_dataset.c2
-rw-r--r--module/zfs/lzjb.c4
-rw-r--r--module/zfs/refcount.c2
-rw-r--r--module/zfs/sa.c6
-rw-r--r--module/zfs/spa.c6
-rw-r--r--module/zfs/spa_misc.c2
-rw-r--r--module/zfs/vdev_file.c2
-rw-r--r--module/zfs/vdev_label.c2
-rw-r--r--module/zfs/vdev_raidz.c9
-rw-r--r--module/zfs/zap_leaf.c2
-rw-r--r--module/zfs/zfs_byteswap.c2
-rw-r--r--module/zfs/zfs_rlock.c2
-rw-r--r--module/zfs/zil.c4
16 files changed, 32 insertions, 27 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index 96c3fb702..1d7fd9e4c 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -2678,7 +2678,7 @@ arc_read_nolock(zio_t *pio, spa_t *spa, const blkptr_t *bp,
uint32_t *arc_flags, const zbookmark_t *zb)
{
arc_buf_hdr_t *hdr;
- arc_buf_t *buf;
+ arc_buf_t *buf = NULL;
kmutex_t *hash_lock;
zio_t *rzio;
uint64_t guid = spa_guid(spa);
@@ -2760,7 +2760,7 @@ top:
uint64_t size = BP_GET_LSIZE(bp);
arc_callback_t *acb;
vdev_t *vd = NULL;
- uint64_t addr;
+ daddr_t addr = -1;
boolean_t devw = B_FALSE;
if (hdr == NULL) {
@@ -3038,7 +3038,7 @@ arc_release(arc_buf_t *buf, void *tag)
arc_buf_hdr_t *hdr;
kmutex_t *hash_lock = NULL;
l2arc_buf_hdr_t *l2hdr;
- uint64_t buf_size;
+ uint64_t buf_size = 0;
/*
* It would be nice to assert that if it's DMU metadata (level >
@@ -4062,7 +4062,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);
@@ -4235,7 +4235,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
list_t *list;
uint64_t passed_sz, write_sz, buf_sz, 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;
diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c
index f2b3f2ba7..732742f33 100644
--- a/module/zfs/dmu.c
+++ b/module/zfs/dmu.c
@@ -355,7 +355,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
uint32_t dbuf_flags;
int err;
zio_t *zio;
- hrtime_t start;
+ hrtime_t start = 0;
ASSERT(length <= DMU_MAX_ACCESS);
diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c
index b3a830217..2d06897db 100644
--- a/module/zfs/dmu_objset.c
+++ b/module/zfs/dmu_objset.c
@@ -1331,7 +1331,7 @@ dmu_objset_userquota_get_ids(dnode_t *dn, boolean_t before, dmu_tx_t *tx)
objset_t *os = dn->dn_objset;
void *data = NULL;
dmu_buf_impl_t *db = NULL;
- uint64_t *user, *group;
+ uint64_t *user = NULL, *group = NULL;
int flags = dn->dn_id_flags;
int error;
boolean_t have_spill = B_FALSE;
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c
index 34fd758c4..226e98828 100644
--- a/module/zfs/dsl_dataset.c
+++ b/module/zfs/dsl_dataset.c
@@ -387,7 +387,7 @@ dsl_dataset_get_ref(dsl_pool_t *dp, uint64_t dsobj, void *tag,
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/module/zfs/lzjb.c b/module/zfs/lzjb.c
index ab3de51b7..ad9e423f8 100644
--- a/module/zfs/lzjb.c
+++ b/module/zfs/lzjb.c
@@ -50,7 +50,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, hash;
uint16_t *hp;
@@ -99,7 +99,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/module/zfs/refcount.c b/module/zfs/refcount.c
index a659c0742..a61554606 100644
--- a/module/zfs/refcount.c
+++ b/module/zfs/refcount.c
@@ -110,7 +110,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/module/zfs/sa.c b/module/zfs/sa.c
index 4e71c407f..37b815f94 100644
--- a/module/zfs/sa.c
+++ b/module/zfs/sa.c
@@ -642,7 +642,7 @@ sa_build_layouts(sa_handle_t *hdl, sa_bulk_attr_t *attr_desc, int attr_count,
int buf_space;
sa_attr_type_t *attrs, *attrs_start;
int i, lot_count;
- int hdrsize, spillhdrsize;
+ int hdrsize, spillhdrsize = 0;
int used;
dmu_object_type_t bonustype;
sa_lot_t *lot;
@@ -813,7 +813,7 @@ sa_attr_table_setup(objset_t *os, sa_attr_reg_t *reg_attrs, int count)
{
sa_os_t *sa = os->os_sa;
uint64_t sa_attr_count = 0;
- uint64_t sa_reg_count;
+ uint64_t sa_reg_count = 0;
int error = 0;
uint64_t attr_value;
sa_attr_table_t *tb;
@@ -1619,7 +1619,7 @@ sa_modify_attrs(sa_handle_t *hdl, sa_attr_type_t newattr,
sa_bulk_attr_t *attr_desc;
void *old_data[2];
int bonus_attr_count = 0;
- int bonus_data_size, spill_data_size;
+ int bonus_data_size = 0, spill_data_size = 0;
int spill_attr_count = 0;
int error;
uint16_t length;
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index 0711102b4..d11f93dbe 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -334,7 +334,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) {
@@ -1144,7 +1144,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;
ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL);
@@ -4019,7 +4019,7 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid, int replace_done)
ASSERTV(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;
char *vdpath;
int c, t;
diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c
index cd8a6c875..32ef51db1 100644
--- a/module/zfs/spa_misc.c
+++ b/module/zfs/spa_misc.c
@@ -399,7 +399,7 @@ spa_lookup(const char *name)
static spa_t search; /* spa_t is large; don't allocate on stack */
spa_t *spa;
avl_index_t where;
- char c;
+ char c = 0;
char *cp;
ASSERT(MUTEX_HELD(&spa_namespace_lock));
diff --git a/module/zfs/vdev_file.c b/module/zfs/vdev_file.c
index 8c22aa531..f31389a6d 100644
--- a/module/zfs/vdev_file.c
+++ b/module/zfs/vdev_file.c
@@ -143,7 +143,7 @@ vdev_file_io_start(zio_t *zio)
{
vdev_t *vd = zio->io_vd;
vdev_file_t *vf = vd->vdev_tsd;
- ssize_t resid;
+ ssize_t resid = 0;
if (zio->io_type == ZIO_TYPE_IOCTL) {
/* XXPOLICY */
diff --git a/module/zfs/vdev_label.c b/module/zfs/vdev_label.c
index 8b400879b..3774d7152 100644
--- a/module/zfs/vdev_label.c
+++ b/module/zfs/vdev_label.c
@@ -612,7 +612,7 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason)
char *buf;
size_t buflen;
int error;
- uint64_t spare_guid, l2cache_guid;
+ uint64_t spare_guid = 0, l2cache_guid = 0;
int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL;
int c, l;
vdev_t *pvd;
diff --git a/module/zfs/vdev_raidz.c b/module/zfs/vdev_raidz.c
index af2de40ac..ef2054233 100644
--- a/module/zfs/vdev_raidz.c
+++ b/module/zfs/vdev_raidz.c
@@ -1189,7 +1189,7 @@ vdev_raidz_matrix_reconstruct(raidz_map_t *rm, int n, int nmissing,
uint64_t ccount;
uint8_t *dst[VDEV_RAIDZ_MAXPARITY];
uint64_t dcount[VDEV_RAIDZ_MAXPARITY];
- uint8_t log, val;
+ uint8_t log = 0, val;
int ll;
uint8_t *invlog[VDEV_RAIDZ_MAXPARITY];
uint8_t *p, *pp;
@@ -1638,8 +1638,11 @@ raidz_checksum_verify(zio_t *zio)
{
zio_bad_cksum_t zbc;
raidz_map_t *rm = zio->io_vsd;
+ int ret;
- int ret = zio_checksum_error(zio, &zbc);
+ bzero(&zbc, sizeof (zio_bad_cksum_t));
+
+ ret = zio_checksum_error(zio, &zbc);
if (ret != 0 && zbc.zbc_injected != 0)
rm->rm_ecksuminjected = 1;
@@ -1862,7 +1865,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;
+ raidz_col_t *rc = NULL;
int unexpected_errors = 0;
int parity_errors = 0;
int parity_untried = 0;
diff --git a/module/zfs/zap_leaf.c b/module/zfs/zap_leaf.c
index 19a795db8..b867ac407 100644
--- a/module/zfs/zap_leaf.c
+++ b/module/zfs/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/module/zfs/zfs_byteswap.c b/module/zfs/zfs_byteswap.c
index acf632bdb..6048eb124 100644
--- a/module/zfs/zfs_byteswap.c
+++ b/module/zfs/zfs_byteswap.c
@@ -51,7 +51,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;
diff --git a/module/zfs/zfs_rlock.c b/module/zfs/zfs_rlock.c
index 7fd8f6020..4e3c176a3 100644
--- a/module/zfs/zfs_rlock.c
+++ b/module/zfs/zfs_rlock.c
@@ -460,7 +460,7 @@ static void
zfs_range_unlock_reader(znode_t *zp, rl_t *remove)
{
avl_tree_t *tree = &zp->z_range_avl;
- rl_t *rl, *next;
+ rl_t *rl, *next = NULL;
uint64_t len;
/*
diff --git a/module/zfs/zil.c b/module/zfs/zil.c
index 751806d33..3c18d43fa 100644
--- a/module/zfs/zil.c
+++ b/module/zfs/zil.c
@@ -296,6 +296,8 @@ zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func,
char *lrbuf, *lrp;
int error = 0;
+ bzero(&next_blk, sizeof(blkptr_t));
+
/*
* Old logs didn't record the maximum zh_claim_lr_seq.
*/
@@ -317,7 +319,7 @@ zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func,
for (blk = zh->zh_log; !BP_IS_HOLE(&blk); blk = next_blk) {
uint64_t blk_seq = blk.blk_cksum.zc_word[ZIL_ZC_SEQ];
int reclen;
- char *end;
+ char *end = NULL;
if (blk_seq > claim_blk_seq)
break;