]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: Fix uninitialized variable in xfs_reflink_reserve_cow_range()
authorGeert Uytterhoeven <geert@linux-m68k.org>
Thu, 20 Oct 2016 04:41:48 +0000 (15:41 +1100)
committerDave Chinner <david@fromorbit.com>
Thu, 20 Oct 2016 04:41:48 +0000 (15:41 +1100)
commitad5264a9a2f0775893bbf8e92853f05a76624622
treef08149589bee3be8ee9ea4cc73a09ddf6a4d34c5
parentf7014b5022e164136983c2b38a4fe1ac061468c0
xfs: Fix uninitialized variable in xfs_reflink_reserve_cow_range()

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: 816a5196548b2b27 ("xfs: create delalloc extents in CoW fork")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_reflink.c