Skip to contentSkip to conversation

xfs: Add delay ready attr remove routines

bug report Dan Carpenter 2 participants 2 messages Jun 17, 2021 – Jun 22, 2021

lore
Share & tools
lore
#0 lore raw

Hello Allison Henderson,

The patch 2b74b03c13c4: "xfs: Add delay ready attr remove routines" from Apr 26, 2021, leads to the following static checker warning:

	fs/xfs/libxfs/xfs_attr.c:1481 xfs_attr_remove_iter()
	error: uninitialized symbol 'error'.

fs/xfs/libxfs/xfs_attr.c
1469 return -EAGAIN;
1470 }
1471
1472 /* fallthrough */
1473 case XFS_DAS_RM_SHRINK:
1474 /*

  1475                   * If the result is small enough, push it all into the inode.
  1476                   * This is our final state so it's safe to return a dirty
  1477                   * transaction.
  1478                   */

1479 if (xfs_attr_is_leaf(dp))
1480 error = xfs_attr_node_shrink(args, state);
1481 ASSERT(error != -EAGAIN);

Not initialized on the else path. It should be zero right?

1482 break;
1483 default:

  1484                  ASSERT(0);
  1485                  error = -EINVAL;
  1486                  goto out;
  1487          }
  1488  out:
  1489          if (state)
  1490                  xfs_da_state_free(state);
  1491          return error;
                ^^^^^^^^^^^^

returned here.

1492 }

regards,
dan carpenter

#1 lore raw
Quoted 23 lines · Dan Carpenter

Hello Allison Henderson,

The patch 2b74b03c13c4: "xfs: Add delay ready attr remove routines" from Apr 26, 2021, leads to the following static checker warning:

	fs/xfs/libxfs/xfs_attr.c:1481 xfs_attr_remove_iter()
	error: uninitialized symbol 'error'.

fs/xfs/libxfs/xfs_attr.c
1469 return -EAGAIN;
1470 }
1471
1472 /* fallthrough */
1473 case XFS_DAS_RM_SHRINK:
1474 /*

   1475                   * If the result is small enough, push it all into the inode.
   1476                   * This is our final state so it's safe to return a dirty
   1477                   * transaction.
   1478                   */
   1479                  if (xfs_attr_is_leaf(dp))
   1480                          error = xfs_attr_node_shrink(args, state);
   1481                  ASSERT(error != -EAGAIN);
Quoted 1 line

Not initialized on the else path. It should be zero right?

Hi Dan,

Thanks for the catch, I just noticed this report. I will sent out a patch initializing error at the start of the function. That should take care of this warning.

Thx!
Allison

Quoted 19 lines
   1482                  break;
   1483          default:
   1484                  ASSERT(0);
   1485                  error = -EINVAL;
   1486                  goto out;
   1487          }
   1488  out:
   1489          if (state)
   1490                  xfs_da_state_free(state);
   1491          return error;
                 ^^^^^^^^^^^^

returned here.

   1492  }

regards,
dan carpenter