[PATCH][ext4-next] ext4: ensure error return ret is zero on successful return

From: Colin King
Date: Fri Jun 23 2017 - 10:58:47 EST


From: Colin Ian King <colin.king@xxxxxxxxxxxxx>

The error return ret is not set on a successful return path and
so it returns a garbage value. Ensure it is is set to zero on
a successful return.

Detected by CoverityScan, CID#1446616 ("Uninitialized scalar variable")

Fixes: 3499c0fb822d ("quota: add get_inode_usage callback to transfer multi-inode charges")

Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
---
fs/ext4/xattr.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index ce12c3fb7e59..f454b2709b5a 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -794,6 +794,7 @@ int ext4_get_inode_usage(struct inode *inode, qsize_t *usage)
ea_inode_refs++;
}
*usage = ea_inode_refs + 1;
+ ret = 0;
out:
brelse(iloc.bh);
brelse(bh);
--
2.11.0