public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Sherry Yang <sherry.yang@oracle.com>
To: djwong@kernel.org, dchinner@redhat.com,
	allison.henderson@oracle.com, chandanrlinux@gmail.com,
	bfoster@redhat.com
Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	sherry.yang@oracle.com
Subject: [PATCH v1] xfs: initialize error in xfs_defer_finish_one
Date: Mon,  1 Aug 2022 12:03:11 -0700	[thread overview]
Message-ID: <20220801190311.65703-1-sherry.yang@oracle.com> (raw)

Path through non-void function 'xfs_defer_finish_one' may return error
uninitialized if no iteration of 'list_for_each_safe' occurs. Fix this
by initializing error.

Fixes: bb47d79750f1 ("xfs: refactor xfs_defer_finish_noroll")
Cc: stable@vger.kernel.org
Signed-off-by: Sherry Yang <sherry.yang@oracle.com>
---
 fs/xfs/libxfs/xfs_defer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c
index 5a321b783398..3188712ff34e 100644
--- a/fs/xfs/libxfs/xfs_defer.c
+++ b/fs/xfs/libxfs/xfs_defer.c
@@ -468,7 +468,7 @@ xfs_defer_finish_one(
 	const struct xfs_defer_op_type	*ops = defer_op_types[dfp->dfp_type];
 	struct xfs_btree_cur		*state = NULL;
 	struct list_head		*li, *n;
-	int				error;
+	int				error = 0;
 
 	trace_xfs_defer_pending_finish(tp->t_mountp, dfp);
 
-- 
2.31.1


             reply	other threads:[~2022-08-01 19:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 19:03 Sherry Yang [this message]
2022-08-01 20:49 ` [PATCH v1] xfs: initialize error in xfs_defer_finish_one Dave Chinner
2022-08-03  4:31   ` Darrick J. Wong
2022-08-03 23:42     ` Sherry Yang
2022-08-04  5:07       ` Darrick J. Wong

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=20220801190311.65703-1-sherry.yang@oracle.com \
    --to=sherry.yang@oracle.com \
    --cc=allison.henderson@oracle.com \
    --cc=bfoster@redhat.com \
    --cc=chandanrlinux@gmail.com \
    --cc=dchinner@redhat.com \
    --cc=djwong@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /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