[bug report] xfs: mark speculative prealloc CoW fork extents unwritten

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux