* [bug report] xfs: streamline xfs_attr3_leaf_inactive
@ 2020-01-23 4:51 Dan Carpenter
2020-01-23 15:54 ` Darrick J. Wong
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-01-23 4:51 UTC (permalink / raw)
To: darrick.wong; +Cc: linux-xfs
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.
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] xfs: streamline xfs_attr3_leaf_inactive
2020-01-23 4:51 [bug report] xfs: streamline xfs_attr3_leaf_inactive Dan Carpenter
@ 2020-01-23 15:54 ` Darrick J. Wong
0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2020-01-23 15:54 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-xfs
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-23 15:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-23 4:51 [bug report] xfs: streamline xfs_attr3_leaf_inactive Dan Carpenter
2020-01-23 15: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).