Skip to contentSkip to conversation

dax: silence an uninitialized variable warning

PATCH In review Dan Carpenter 2 participants 2 messages Mar 22, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dax: silence an uninitialized variable warning

I'm not positive, but it looks like it might be possible to reach the end of this function and return an uninitialized value for "rc". Anyway it causes a static checker warning and let's silence it.

The warning was introduced in commit b2e0d1625e19 ('dax: fix lifetime of in-kernel dax mappings with dax_map_atomic()').

fs/dax.c +2 -1
index 90322eb..3744e14 100644
@@ -155,7 +155,8 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
 	loff_t pos = start, max = start, bh_max = start;
 	bool hole = false, need_wmb = false;
 	struct block_device *bdev = NULL;
-	int rw = iov_iter_rw(iter), rc;
+	int rc = 0;
+	int rw = iov_iter_rw(iter);
 	long map_len = 0;
 	struct blk_dax_ctl dax = {
 		.addr = (void __pmem *) ERR_PTR(-EIO),
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Dan Carpenter

I'm not positive, but it looks like it might be possible to reach the end of this function and return an uninitialized value for "rc". Anyway it causes a static checker warning and let's silence it.

The warning was introduced in commit b2e0d1625e19 ('dax: fix lifetime of in-kernel dax mappings with dax_map_atomic()').

Looks good to me.

Quoted 19 lines
fs/dax.c +2 -2
index 90322eb..3744e14 100644
@@ -155,7 +155,8 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
 	loff_t pos = start, max = start, bh_max = start;
 	bool hole = false, need_wmb = false;
 	struct block_device *bdev = NULL;
-	int rw = iov_iter_rw(iter), rc;
+	int rc = 0;
+	int rw = iov_iter_rw(iter);
 	long map_len = 0;
 	struct blk_dax_ctl dax = {
 		.addr = (void __pmem *) ERR_PTR(-EIO),
--

To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html