Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1501914

Re: [PATCH] xfs: Fix uninitialized variable in xfs_reflink_reserve_cow_range()

From Christoph Hellwig <hch@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH] xfs: Fix uninitialized variable in xfs_reflink_reserve_cow_range()
Date 2016-10-17 14:10 +0200
Message-ID <steTT-3gZ-17@gated-at.bofh.it> (permalink)
References <stdbs-2aY-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

The iomap API should never call in with a zero count, but I think the
initialization is a fine safety net anyway:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Btw, what compiler did you get this from?  I haven't seen it, but then
again I recently missed a lot of initializers without compiler warnings,
so either something changed in the Debian stable gcc or our build
system recently..

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] xfs: Fix uninitialized variable in xfs_reflink_reserve_cow_range() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-10-17 12:20 +0200
  Re: [PATCH] xfs: Fix uninitialized variable in  xfs_reflink_reserve_cow_range() Christoph Hellwig <hch@infradead.org> - 2016-10-17 14:10 +0200
    Re: [PATCH] xfs: Fix uninitialized variable in xfs_reflink_reserve_cow_range() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-10-17 14:20 +0200
  Re: [PATCH] xfs: Fix uninitialized variable in  xfs_reflink_reserve_cow_range() "Darrick J. Wong" <darrick.wong@oracle.com> - 2016-10-17 20:40 +0200

csiph-web