Author: jhb
Date: Wed Sep 30 17:49:06 2020
New Revision: 366296
URL: https://svnweb.freebsd.org/changeset/base/366296

Log:
  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

Modified:
  head/sys/kern/vfs_aio.c

Modified: head/sys/kern/vfs_aio.c
==============================================================================
--- head/sys/kern/vfs_aio.c     Wed Sep 30 17:10:49 2020        (r366295)
+++ head/sys/kern/vfs_aio.c     Wed Sep 30 17:49:06 2020        (r366296)
@@ -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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to