Skip to contentSkip to conversation

xfs: fix uninitialized variable in xfs_attr3_leaf_inactive

PATCH In review Darrick J. Wong 3 participants 3 messages Jan 23, 2020 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: fix uninitialized variable in xfs_attr3_leaf_inactive

From: Darrick J. Wong <[email protected]>

Dan Carpenter pointed out that error is uninitialized. While there never should be an attr leaf block with zero entries, let's not leave that logic bomb there.

---
 fs/xfs/xfs_attr_inactive.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_attr_inactive.c +1 -1
index eddd5d311b0c..bbfa6ba84dcd 100644
@@ -89,7 +89,7 @@ xfs_attr3_leaf_inactive(
 	struct xfs_attr_leafblock	*leaf = bp->b_addr;
 	struct xfs_attr_leaf_entry	*entry;
 	struct xfs_attr_leaf_name_remote *name_rmt;
-	int				error;
+	int				error = 0;
 	int				i;
 
 	xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Dan Carpenter pointed out that error is uninitialized. While there never should be an attr leaf block with zero entries, let's not leave that logic bomb there.

Looks fine to me.

Quoted 20 lines
---
  fs/xfs/xfs_attr_inactive.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_attr_inactive.c +1 -1
index eddd5d311b0c..bbfa6ba84dcd 100644
@@ -89,7 +89,7 @@ xfs_attr3_leaf_inactive(
  	struct xfs_attr_leafblock	*leaf = bp->b_addr;
  	struct xfs_attr_leaf_entry	*entry;
  	struct xfs_attr_leaf_name_remote *name_rmt;
-	int				error;
+	int				error = 0;
  	int				i;
 
  	xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);
Reviewed-by on v1 1/1
#2 lore raw
In reply to Darrick J. Wong
Quoted 8 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Dan Carpenter pointed out that error is uninitialized. While there never should be an attr leaf block with zero entries, let's not leave that logic bomb there.

Fixes 0bb9d159bd01 ("xfs: streamline xfs_attr3_leaf_inactive")
Quoted 18 lines
---
 fs/xfs/xfs_attr_inactive.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_attr_inactive.c +1 -1
index eddd5d311b0c..bbfa6ba84dcd 100644
@@ -89,7 +89,7 @@ xfs_attr3_leaf_inactive(
 	struct xfs_attr_leafblock	*leaf = bp->b_addr;
 	struct xfs_attr_leaf_entry	*entry;
 	struct xfs_attr_leaf_name_remote *name_rmt;
-	int				error;
+	int				error = 0;
 	int				i;
 
 	xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);