From: Darrick J. Wong Date: Wed, 22 Jan 2020 16:29:40 +0000 (-0500) Subject: xfs: null out bma->prev if no previous extent X-Git-Tag: v5.5.0-rc0~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=530bc0fc4799b3edfb5803b9fd6a50ee3c087e07;p=thirdparty%2Fxfsprogs-dev.git xfs: null out bma->prev if no previous extent Source kernel commit: f5be08446ee748785697527c8d772d896814b95f Coverity complains that we don't check the return value of xfs_iext_peek_prev_extent like we do nearly all of the time. If there is no previous extent then just null out bma->prev like we do elsewhere in the bmap code. Coverity-id: 1424057 Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index bd117a30a..b1edc10d1 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -4006,7 +4006,8 @@ xfs_bmapi_allocate( if (bma->wasdel) { bma->length = (xfs_extlen_t)bma->got.br_blockcount; bma->offset = bma->got.br_startoff; - xfs_iext_peek_prev_extent(ifp, &bma->icur, &bma->prev); + if (!xfs_iext_peek_prev_extent(ifp, &bma->icur, &bma->prev)) + bma->prev.br_startoff = NULLFILEOFF; } else { bma->length = XFS_FILBLKS_MIN(bma->length, MAXEXTLEN); if (!bma->eof)