From: Darrick J. Wong Date: Wed, 6 Nov 2019 16:53:54 +0000 (-0800) Subject: xfs: null out bma->prev if no previous extent X-Git-Tag: v5.5-rc1~71^2~94 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f5be08446ee748785697527c8d772d896814b95f;p=thirdparty%2Fkernel%2Flinux.git xfs: null out bma->prev if no previous extent 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 --- diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 64f623d07f82c..7392ca92ab344 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -4014,7 +4014,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)