Avoid a dubious assignment to bio_data in aio_qbio().

A user pointer is not a suitable value for bio_data and the next block
of code always overwrites bio_data anyway.  Just use cb->aio_buf
directly in the call to vm_fault_quick_hold_pages().

Reviewed by:	kib
Obtained from:	CheriBSD
MFC after:	1 month
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26595
This commit is contained in:
John Baldwin 2020-09-30 17:49:06 +00:00
parent 6b74091dd5
commit 8128c65b4c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=366296

View File

@ -1278,7 +1278,6 @@ aio_qbio(struct proc *p, struct kaiocb *job)
bp->bio_length = cb->aio_nbytes;
bp->bio_bcount = cb->aio_nbytes;
bp->bio_done = aio_biowakeup;
bp->bio_data = (void *)(uintptr_t)cb->aio_buf;
bp->bio_offset = cb->aio_offset;
bp->bio_cmd = cb->aio_lio_opcode == LIO_WRITE ? BIO_WRITE : BIO_READ;
bp->bio_dev = dev;
@ -1288,7 +1287,7 @@ aio_qbio(struct proc *p, struct kaiocb *job)
if (cb->aio_lio_opcode == LIO_READ)
prot |= VM_PROT_WRITE; /* Less backwards than it looks */
job->npages = vm_fault_quick_hold_pages(&curproc->p_vmspace->vm_map,
(vm_offset_t)bp->bio_data, bp->bio_length, prot, job->pages,
(vm_offset_t)cb->aio_buf, bp->bio_length, prot, job->pages,
nitems(job->pages));
if (job->npages < 0) {
error = EFAULT;