Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1673622 > unrolled thread

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

Started byColin King <colin.king@canonical.com>
First post2017-06-23 17:00 +0200
Last post2017-06-23 19:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH][ext4-next] ext4: ensure error return ret is zero on successful return Colin King <colin.king@canonical.com> - 2017-06-23 17:00 +0200
    Re: [PATCH][ext4-next] ext4: ensure error return ret is zero on  successful return Tahsin Erdogan <tahsin@google.com> - 2017-06-23 19:10 +0200

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

FromColin King <colin.king@canonical.com>
Date2017-06-23 17:00 +0200
Subject[PATCH][ext4-next] ext4: ensure error return ret is zero on successful return
Message-ID<tVydY-3t1-13@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

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@canonical.com>
---
 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

[toc] | [next] | [standalone]


#1673692 — Re: [PATCH][ext4-next] ext4: ensure error return ret is zero on successful return

FromTahsin Erdogan <tahsin@google.com>
Date2017-06-23 19:10 +0200
SubjectRe: [PATCH][ext4-next] ext4: ensure error return ret is zero on successful return
Message-ID<tVAfM-4XT-15@gated-at.bofh.it>
In reply to#1673622
On Fri, Jun 23, 2017 at 7:58 AM, Colin King <colin.king@canonical.com> wrote:
> 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.
Thanks for catching this bug!

Reviewed-by: Tahsin Erdogan <tahsin@google.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web