diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2020-03-13 23:17:40 +0300 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2020-03-15 19:22:35 +0300 |
commit | faf8ee8476c19b30fd16079ad616b2b0f56eaff4 (patch) | |
tree | 4edb9803f5fd1aaad54d9f00cd196051166ff1f7 /fs/xfs/libxfs/xfs_da_btree.c | |
parent | 13859c984301ac4c1b2b3504b9f342aaddaa4a8a (diff) | |
download | linux-faf8ee8476c19b30fd16079ad616b2b0f56eaff4.tar.xz |
xfs: xfs_dabuf_map should return ENOMEM when map allocation fails
If the xfs_buf_map array allocation in xfs_dabuf_map fails for whatever
reason, we bail out with error code zero. This will confuse callers, so
make sure that we return ENOMEM. Allocation failure should never happen
with the small size of the array, but code defensively anyway.
Fixes: 45feef8f50b94d ("xfs: refactor xfs_dabuf_map")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_da_btree.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_da_btree.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c index a7880c6285db..897749c41f36 100644 --- a/fs/xfs/libxfs/xfs_da_btree.c +++ b/fs/xfs/libxfs/xfs_da_btree.c @@ -2521,8 +2521,10 @@ xfs_dabuf_map( */ if (nirecs > 1) { map = kmem_zalloc(nirecs * sizeof(struct xfs_buf_map), KM_NOFS); - if (!map) + if (!map) { + error = -ENOMEM; goto out_free_irecs; + } *mapp = map; } |