linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][ext4-next] ext4: ensure error return ret is zero on successful return
@ 2017-06-23 14:58 Colin King
  2017-06-23 17:04 ` Tahsin Erdogan
  2017-07-06 19:28 ` Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2017-06-23 14:58 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger, linux-ext4
  Cc: kernel-janitors, linux-kernel

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][ext4-next] ext4: ensure error return ret is zero on successful return
  2017-06-23 14:58 [PATCH][ext4-next] ext4: ensure error return ret is zero on successful return Colin King
@ 2017-06-23 17:04 ` Tahsin Erdogan
  2017-07-06 19:28 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Tahsin Erdogan @ 2017-06-23 17:04 UTC (permalink / raw)
  To: Colin King
  Cc: Theodore Ts'o, Andreas Dilger, linux-ext4, kernel-janitors,
	linux-kernel

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][ext4-next] ext4: ensure error return ret is zero on successful return
  2017-06-23 14:58 [PATCH][ext4-next] ext4: ensure error return ret is zero on successful return Colin King
  2017-06-23 17:04 ` Tahsin Erdogan
@ 2017-07-06 19:28 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2017-07-06 19:28 UTC (permalink / raw)
  To: Colin King; +Cc: Andreas Dilger, linux-ext4, kernel-janitors, linux-kernel

On Fri, Jun 23, 2017 at 03:58:40PM +0100, Colin King wrote:
> 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>

Thanks, I've folded this into the "quota: add get_inode_usage callback
to transfer multi-inode charges" with credit for your providing the
fix.

					- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-06 19:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-23 14:58 [PATCH][ext4-next] ext4: ensure error return ret is zero on successful return Colin King
2017-06-23 17:04 ` Tahsin Erdogan
2017-07-06 19:28 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).