aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-03-19 11:16:22 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2019-03-19 11:16:54 -0400
commit4b0bce30f39b7733420bb8b28e340aa91c219bc1 (patch)
tree49ba14d470902a600d6b706cd1c557901ed1e458 /fs/xfs
parenta72e9d8d69e7ca848ddd4c4db72d3ab280c1775d (diff)
xfs: always init bma in xfs_bmapi_write
Always init the tp/ip fields of bma in xfs_bmapi_write so that the bmapi_finish at the bottom never trips over null transaction or inode pointers. Coverity-id: 1443964 Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index ae4c3b0d84db..4637ae1ae91c 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -4252,9 +4252,13 @@ xfs_bmapi_write(
4252 struct xfs_bmbt_irec *mval, /* output: map values */ 4252 struct xfs_bmbt_irec *mval, /* output: map values */
4253 int *nmap) /* i/o: mval size/count */ 4253 int *nmap) /* i/o: mval size/count */
4254{ 4254{
4255 struct xfs_bmalloca bma = {
4256 .tp = tp,
4257 .ip = ip,
4258 .total = total,
4259 };
4255 struct xfs_mount *mp = ip->i_mount; 4260 struct xfs_mount *mp = ip->i_mount;
4256 struct xfs_ifork *ifp; 4261 struct xfs_ifork *ifp;
4257 struct xfs_bmalloca bma = { NULL }; /* args for xfs_bmap_alloc */
4258 xfs_fileoff_t end; /* end of mapped file region */ 4262 xfs_fileoff_t end; /* end of mapped file region */
4259 bool eof = false; /* after the end of extents */ 4263 bool eof = false; /* after the end of extents */
4260 int error; /* error return */ 4264 int error; /* error return */
@@ -4322,10 +4326,6 @@ xfs_bmapi_write(
4322 eof = true; 4326 eof = true;
4323 if (!xfs_iext_peek_prev_extent(ifp, &bma.icur, &bma.prev)) 4327 if (!xfs_iext_peek_prev_extent(ifp, &bma.icur, &bma.prev))
4324 bma.prev.br_startoff = NULLFILEOFF; 4328 bma.prev.br_startoff = NULLFILEOFF;
4325 bma.tp = tp;
4326 bma.ip = ip;
4327 bma.total = total;
4328 bma.datatype = 0;
4329 bma.minleft = xfs_bmapi_minleft(tp, ip, whichfork); 4329 bma.minleft = xfs_bmapi_minleft(tp, ip, whichfork);
4330 4330
4331 n = 0; 4331 n = 0;