linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] xfs: mark speculative prealloc CoW fork extents unwritten
@ 2017-02-13 19:03 Dan Carpenter
  2017-02-14  6:54 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-02-13 19:03 UTC (permalink / raw)
  To: darrick.wong; +Cc: linux-xfs

Hello Darrick J. Wong,

The patch 5eda43000064: "xfs: mark speculative prealloc CoW fork
extents unwritten" from Feb 2, 2017, leads to the following static
checker warning:

	fs/xfs/xfs_reflink.c:381 xfs_reflink_convert_cow()
	error: uninitialized symbol 'error'.

fs/xfs/xfs_reflink.c
   350  /* Convert all of the unwritten CoW extents in a file's range to real ones. */
   351  int
   352  xfs_reflink_convert_cow(
   353          struct xfs_inode        *ip,
   354          xfs_off_t               offset,
   355          xfs_off_t               count)
   356  {
   357          struct xfs_bmbt_irec    got;
   358          struct xfs_defer_ops    dfops;
   359          struct xfs_mount        *mp = ip->i_mount;
   360          struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK);
   361          xfs_fileoff_t           offset_fsb = XFS_B_TO_FSBT(mp, offset);
   362          xfs_fileoff_t           end_fsb = XFS_B_TO_FSB(mp, offset + count);
   363          xfs_extnum_t            idx;
   364          bool                    found;
   365          int                     error;
                                        ^^^^^
   366  
   367          xfs_ilock(ip, XFS_ILOCK_EXCL);
   368  
   369          /* Convert all the extents to real from unwritten. */
   370          for (found = xfs_iext_lookup_extent(ip, ifp, offset_fsb, &idx, &got);
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What if found fails on the first iteration through the loop?

   371               found && got.br_startoff < end_fsb;
   372               found = xfs_iext_get_extent(ifp, ++idx, &got)) {
   373                  error = xfs_reflink_convert_cow_extent(ip, &got, offset_fsb,
   374                                  end_fsb - offset_fsb, &dfops);
   375                  if (error)
   376                          break;
   377          }
   378  
   379          /* Finish up. */
   380          xfs_iunlock(ip, XFS_ILOCK_EXCL);
   381          return error;
                ^^^^^^^^^^^^
   382  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-14  6:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-13 19:03 [bug report] xfs: mark speculative prealloc CoW fork extents unwritten Dan Carpenter
2017-02-14  6:54 ` Darrick J. Wong

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).