From: Jan Kara <jack@suse.com>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com, Jan Kara <jack@suse.com>
Subject: [PATCH] xfs: Fix uninitialized return value in xfs_alloc_fix_freelist()
Date: Wed, 15 Jul 2015 10:16:08 +0200 [thread overview]
Message-ID: <1436948168-25051-1-git-send-email-jack@suse.com> (raw)
xfs_alloc_fix_freelist() can sometimes jump to out_agbp_relse without
ever setting value of 'error' variable which is then returned. This can
happen e.g. when pag->pagf_init is set but AG is for metadata and we
want to allocate user data.
Fix the problem by initializing 'error' to 0, which is the desired
return value when we decide to skip this group.
CC: xfs@oss.sgi.com
Coverity-id: 1309714
Signed-off-by: Jan Kara <jack@suse.com>
---
fs/xfs/libxfs/xfs_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index f9e9ffe6fb46..7f8f2a0d4567 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -1937,7 +1937,7 @@ xfs_alloc_fix_freelist(
struct xfs_alloc_arg targs; /* local allocation arguments */
xfs_agblock_t bno; /* freelist block */
xfs_extlen_t need; /* total blocks needed in freelist */
- int error;
+ int error = 0;
if (!pag->pagf_init) {
error = xfs_alloc_read_agf(mp, tp, args->agno, flags, &agbp);
--
2.1.4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2015-07-15 8:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-15 8:16 Jan Kara [this message]
2015-07-15 11:16 ` [PATCH] xfs: Fix uninitialized return value in xfs_alloc_fix_freelist() Brian Foster
2015-08-19 17:40 ` Eric Sandeen
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=1436948168-25051-1-git-send-email-jack@suse.com \
--to=jack@suse.com \
--cc=david@fromorbit.com \
--cc=xfs@oss.sgi.com \
/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