Skip to contentSkip to conversation

xfs: fix an error code in xfs_fs_fill_super()

PATCH In review Dan Carpenter 2 participants 2 messages Oct 15, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: fix an error code in xfs_fs_fill_super()

If alloc_percpu() fails, we accidentally return PTR_ERR(NULL), which means success, but we intended to return -ENOMEM.

Fixes 225e4635580c ('xfs: per-filesystem stats in sysfs')
fs/xfs/xfs_super.c +1 -1
index 368c55a..b2c252c 100644
@@ -1477,7 +1477,7 @@ xfs_fs_fill_super(
 	/* Allocate stats memory before we do operations that might use it */
 	mp->m_stats.xs_stats = alloc_percpu(struct xfsstats);
 	if (!mp->m_stats.xs_stats) {
-		error = PTR_ERR(mp->m_stats.xs_stats);
+		error = -ENOMEM;
 		goto out_destroy_counters;
 	}
 
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Dan Carpenter

If alloc_percpu() fails, we accidentally return PTR_ERR(NULL), which means success, but we intended to return -ENOMEM.

Fixes 225e4635580c ('xfs: per-filesystem stats in sysfs')
fs/xfs/xfs_super.c +0 -0
index 368c55a..b2c252c 100644

fs/xfs/xfs_super.c xfs_fs_fill_super( · line 1483

Quoted 8 lines
fs/xfs/xfs_super.c +1 -1
@@ -1477,7 +1477,7 @@ xfs_fs_fill_super(
 	/* Allocate stats memory before we do operations that might use it */
 	mp->m_stats.xs_stats = alloc_percpu(struct xfsstats);
 	if (!mp->m_stats.xs_stats) {
-		error = PTR_ERR(mp->m_stats.xs_stats);
+		error = -ENOMEM;
 		goto out_destroy_counters;
 	}
 

Agreed. Thanks for the patch.