o Check the b_bufsize passed to vmapbuf() returning an error

if it is invalid.
 o Remove a debugging printf() from vmapbuf().

Suggested by:   tegge
This commit is contained in:
Alan Cox 2003-04-04 06:14:54 +00:00
parent 76d94537fe
commit 08468b6ad7

View File

@ -3618,7 +3618,8 @@ vmapbuf(struct buf *bp)
if ((bp->b_flags & B_PHYS) == 0)
panic("vmapbuf");
if (bp->b_bufsize < 0)
return (-1);
for (addr = (caddr_t)trunc_page((vm_offset_t)bp->b_data), pidx = 0;
addr < bp->b_data + bp->b_bufsize;
addr += PAGE_SIZE, pidx++) {
@ -3635,7 +3636,6 @@ retry:
(bp->b_iocmd == BIO_READ) ?
(VM_PROT_READ|VM_PROT_WRITE) : VM_PROT_READ);
if (i < 0) {
printf("vmapbuf: warning, bad user address during I/O\n");
vm_page_lock_queues();
for (i = 0; i < pidx; ++i) {
vm_page_unhold(bp->b_pages[i]);