| To: | xfs@xxxxxxxxxxx |
|---|---|
| Subject: | [report] potential uninitialized variable in xfs_dir2_node_to_leaf() |
| From: | Dan Carpenter <dan.carpenter@xxxxxxxxxx> |
| Date: | Thu, 10 Mar 2016 16:28:16 +0300 |
| Delivered-to: | xfs@xxxxxxxxxxx |
| User-agent: | Mutt/1.5.24 (2015-08-30) |
Hello XFS devs,
I get the following static checker warning:
fs/xfs/libxfs/xfs_dir2_leaf.c:1726 xfs_dir2_node_to_leaf()
error: potentially using uninitialized 'rval'.
fs/xfs/libxfs/xfs_dir2_leaf.c
1691 int rval; /* successful free
trim? */
^^^^
1692 xfs_trans_t *tp; /* transaction pointer
*/
1693 struct xfs_dir3_icleaf_hdr leafhdr;
1694 struct xfs_dir3_icfree_hdr freehdr;
1695
1696 /*
1697 * There's more than a leaf level in the btree, so there must
1698 * be multiple leafn blocks. Give up.
1699 */
1700 if (state->path.active > 1)
1701 return 0;
1702 args = state->args;
1703
1704 trace_xfs_dir2_node_to_leaf(args);
1705
1706 mp = state->mp;
1707 dp = args->dp;
1708 tp = args->trans;
1709 /*
1710 * Get the last offset in the file.
1711 */
1712 if ((error = xfs_bmap_last_offset(dp, &fo, XFS_DATA_FORK))) {
1713 return error;
1714 }
1715 fo -= args->geo->fsbcount;
1716 /*
1717 * If there are freespace blocks other than the first one,
1718 * take this opportunity to remove trailing empty freespace
blocks
1719 * that may have been left behind during no-space-reservation
1720 * operations.
1721 */
1722 while (fo > args->geo->freeblk) {
1723 if ((error = xfs_dir2_node_trim_free(args, fo, &rval)))
{
^^^^
The first "return 0" happens before "rval" is initialized.
1724 return error;
1725 }
1726 if (rval)
^^^^
1727 fo -= args->geo->fsbcount;
1728 else
1729 return 0;
1730 }
regards,
dan carpenter
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | re: xfs: eliminate committed arg from xfs_bmap_finish, Dan Carpenter |
|---|---|
| Next by Date: | Re: xfs: eliminate committed arg from xfs_bmap_finish, Eric Sandeen |
| Previous by Thread: | re: xfs: eliminate committed arg from xfs_bmap_finish, Dan Carpenter |
| Next by Thread: | Goodbye from our Newsletter, PowerPC |
| Indexes: | [Date] [Thread] [Top] [All Lists] |