public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Colin King <colin.king@canonical.com>
To: Theodore Ts'o <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	linux-ext4@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH][ext4-next] ext4: ensure error return ret is zero on successful return
Date: Fri, 23 Jun 2017 15:58:40 +0100	[thread overview]
Message-ID: <20170623145840.26779-1-colin.king@canonical.com> (raw)

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

             reply	other threads:[~2017-06-23 14:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23 14:58 Colin King [this message]
2017-06-23 17:04 ` [PATCH][ext4-next] ext4: ensure error return ret is zero on successful return Tahsin Erdogan
2017-07-06 19:28 ` Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170623145840.26779-1-colin.king@canonical.com \
    --to=colin.king@canonical.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox