Avoid overfow in vtruncbuf()

Using daddr_t instead of int avoids trunclbn to become negative when it
shouldn't.
This isssue was found by running syzkaller.

Reviewed by:		mckusick, kib, markj
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D18763
This commit is contained in:
tuexen 2019-01-08 09:04:27 +00:00
parent aa320c199b
commit e8a9c3693f

View File

@ -1858,7 +1858,7 @@ vtruncbuf(struct vnode *vp, struct ucred *cred, off_t length, int blksize)
{
struct buf *bp, *nbp;
int anyfreed;
int trunclbn;
daddr_t trunclbn;
struct bufobj *bo;
CTR5(KTR_VFS, "%s: vp %p with cred %p and block %d:%ju", __func__,