From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Dave Chinner <david@fromorbit.com>,
linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: Fix uninitialized variable in xfs_reflink_reserve_cow_range()
Date: Mon, 17 Oct 2016 11:36:05 -0700 [thread overview]
Message-ID: <20161017183605.GA26485@birch.djwong.org> (raw)
In-Reply-To: <1476699404-5977-1-git-send-email-geert@linux-m68k.org>
On Mon, Oct 17, 2016 at 12:16:44PM +0200, Geert Uytterhoeven wrote:
> with gcc 4.1.2:
>
> fs/xfs/xfs_reflink.c: In function ‘xfs_reflink_reserve_cow_range’:
> fs/xfs/xfs_reflink.c:327: warning: ‘error’ may be used uninitialized in this function
>
> Indeed, if "count" is zero, the function will return an uninitialized
> error value.
>
> While "count" is unlikely to be zero, this function is called through
> the public iomap API. Hence fix this by preinitializing error to zero.
>
> Fixes: 2a06705cd5954030 ("xfs: create delalloc extents in CoW fork")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_reflink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index 5965e9455d91e036..d48a7cc2fe007f66 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -324,7 +324,7 @@
> struct xfs_mount *mp = ip->i_mount;
> xfs_fileoff_t offset_fsb, end_fsb;
> bool skipped = false;
> - int error;
> + int error = 0;
>
> trace_xfs_reflink_reserve_cow_range(ip, offset, count);
>
> --
> 1.9.1
>
prev parent reply other threads:[~2016-10-17 18:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-17 10:16 [PATCH] xfs: Fix uninitialized variable in xfs_reflink_reserve_cow_range() Geert Uytterhoeven
2016-10-17 12:08 ` Christoph Hellwig
2016-10-17 12:13 ` Geert Uytterhoeven
2016-10-17 18:36 ` Darrick J. Wong [this message]
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=20161017183605.GA26485@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=geert@linux-m68k.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;
as well as URLs for NNTP newsgroup(s).