iommu_dvmamap_load_raw: add a check for creating maps larger than

expected by the creator of the dma map and fail apropriately. This
makes the syssrc/dev/pci/if_vr.c driver work.
This commit is contained in:
martin 2001-01-25 21:41:10 +00:00
parent 90a4ab0deb
commit f4eec8f31f

View File

@ -1,4 +1,4 @@
/* $NetBSD: iommu.c,v 1.26 2001/01/23 20:31:28 martin Exp $ */
/* $NetBSD: iommu.c,v 1.27 2001/01/25 21:41:10 martin Exp $ */
/*
* Copyright (c) 1999, 2000 Matthew R. Green
@ -723,7 +723,7 @@ iommu_dvmamap_load_raw(t, is, map, segs, nsegs, flags, size)
* move to a new virtual page.
*/
offset = (segs[i].ds_addr & PGOFSET);
if (trunc_page(pa) != trunc_page(segs[i].ds_addr))
if (trunc_page(pa) != trunc_page(segs[i].ds_addr))
dvmaddr += NBPG;
pa = segs[i].ds_addr;
@ -735,6 +735,11 @@ iommu_dvmamap_load_raw(t, is, map, segs, nsegs, flags, size)
}
map->dm_nsegs = i;
if (i > map->_dm_segcnt) {
iommu_dvmamap_unload(t, is, map);
return (E2BIG);
}
return (0);
}
/*