Re: [bug report] xfs: streamline xfs_attr3_leaf_inactive

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

 



On Thu, Jan 23, 2020 at 07:51:44AM +0300, Dan Carpenter wrote:
> Hello Darrick J. Wong,
> 
> The patch 0bb9d159bd01: "xfs: streamline xfs_attr3_leaf_inactive"
> from Jan 14, 2020, leads to the following static checker warning:
> 
> 	fs/xfs/xfs_attr_inactive.c:122 xfs_attr3_leaf_inactive()
> 	error: uninitialized symbol 'error'.
> 
> fs/xfs/xfs_attr_inactive.c
>     90          struct xfs_attr_leaf_entry      *entry;
>     91          struct xfs_attr_leaf_name_remote *name_rmt;
>     92          int                             error;
>                                                 ^^^^^
> 
>     93          int                             i;
>     94  
>     95          xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);
>     96  
>     97          /*
>     98           * Find the remote value extents for this leaf and invalidate their
>     99           * incore buffers.
>    100           */
>    101          entry = xfs_attr3_leaf_entryp(leaf);
>    102          for (i = 0; i < ichdr.count; entry++, i++) {
> 
> Smatch complains that we might not enter this loop or maybe we always
> hit a continue statement.

In theory there should never be an attr leaf block with zero entries,
but let's fix this anyway.  Patch soon; thanks for the bug report. :)

--D

>    103                  int             blkcnt;
>    104  
>    105                  if (!entry->nameidx || (entry->flags & XFS_ATTR_LOCAL))
>    106                          continue;
>    107  
>    108                  name_rmt = xfs_attr3_leaf_name_remote(leaf, i);
>    109                  if (!name_rmt->valueblk)
>    110                          continue;
>    111  
>    112                  blkcnt = xfs_attr3_rmt_blocks(dp->i_mount,
>    113                                  be32_to_cpu(name_rmt->valuelen));
>    114                  error = xfs_attr3_rmt_stale(dp,
>    115                                  be32_to_cpu(name_rmt->valueblk), blkcnt);
>    116                  if (error)
>    117                          goto err;
>    118          }
>    119  
>    120          xfs_trans_brelse(*trans, bp);
>    121  err:
>    122          return error;
> 
> Possibly uninitialized
> 
>    123  }
> 
> regards,
> dan carpenter



[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