xfs: Fix uninitialized return value in xfs_alloc_fix_freelist()
PATCH 1/1 xfs: Fix uninitialized return value in xfs_alloc_fix_freelist()
xfs_alloc_fix_freelist() can sometimes jump to out_agbp_relse without ever setting value of 'error' variable which is then returned. This can happen e.g. when pag->pagf_init is set but AG is for metadata and we want to allocate user data.
Fix the problem by initializing 'error' to 0, which is the desired return value when we decide to skip this group.
CC: [email protected]
Coverity-id: 1309714
--- fs/xfs/libxfs/xfs_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/libxfs/xfs_alloc.c +1 -1
@@ -1937,7 +1937,7 @@ xfs_alloc_fix_freelist(struct xfs_alloc_arg targs;/* local allocation arguments */ xfs_agblock_t bno;/* freelist block */ xfs_extlen_t need;/* total blocks needed in freelist */ -int error; +int error =0 ;if (!pag->pagf_init) { error =xfs_alloc_read_agf (mp, tp, args->agno, flags, &agbp);
Signature · 6 lines
2.1.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 5 lines · Jan Kara
xfs_alloc_fix_freelist()can sometimes jump toout_agbp_relsewithout ever setting value of 'error' variable which is then returned. This can happen e.g. whenpag->pagf_initis set but AG is for metadata and we want to allocate user data.
Quoted 7 lines
Fix the problem by initializing 'error' to 0, which is the desired return value when we decide to skip this group.
CC: [email protected]
Coverity-id: 1309714Signed-off-by Jan Kara <[email protected]>---
Quoted 23 lines
fs/xfs/libxfs/xfs_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/libxfs/xfs_alloc.c +1
-1@@ -1937,7 +1937,7 @@ xfs_alloc_fix_freelist(struct xfs_alloc_arg targs;/* local allocation arguments */ xfs_agblock_t bno;/* freelist block */ xfs_extlen_t need;/* total blocks needed in freelist */ -int error; +int error =0 ;if (!pag->pagf_init) { error =xfs_alloc_read_agf (mp, tp, args->agno, flags, &agbp);Signature · 6 lines
2.1.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 9 lines · Brian Foster
Quoted 8 lines · Jan Kara
xfs_alloc_fix_freelist()can sometimes jump toout_agbp_relsewithout ever setting value of 'error' variable which is then returned. This can happen e.g. whenpag->pagf_initis set but AG is for metadata and we want to allocate user data.Fix the problem by initializing 'error' to 0, which is the desired return value when we decide to skip this group.
Quoted 6 lines
Quoted 4 lines
CC: [email protected]
Coverity-id: 1309714Signed-off-by Jan Kara <[email protected]>---
Reviewed-by Brian Foster <[email protected]>
Dave, ping on this one? I don't see it in your latest update, looks important. (xfsprogs has the same problem, FWIW)
-Eric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs