diff options
author | Henric Jungheim <henric@cvs.openbsd.org> | 2003-05-22 21:16:30 +0000 |
---|---|---|
committer | Henric Jungheim <henric@cvs.openbsd.org> | 2003-05-22 21:16:30 +0000 |
commit | a0ff266e224d31e5fd5b12efb00c3ca1bc9ada8c (patch) | |
tree | 3c03fe271a3eb94f67902e04e870234a6faea859 | |
parent | 77d96fd9c75b4e96f2dbf846255e99bd9e11e0fd (diff) |
There's an off-by-one in the diagnostic code that can cause grief,
especially for NIC drivers that aren't careful about handling load
failures.
Bug reported and diff tested by Holger Burde.
ok jason@.
-rw-r--r-- | sys/arch/sparc64/dev/iommu.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/arch/sparc64/dev/iommu.c b/sys/arch/sparc64/dev/iommu.c index 6e630d3b9a6..09dec097bec 100644 --- a/sys/arch/sparc64/dev/iommu.c +++ b/sys/arch/sparc64/dev/iommu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iommu.c,v 1.28 2003/03/06 08:26:08 henric Exp $ */ +/* $OpenBSD: iommu.c,v 1.29 2003/05/22 21:16:29 henric Exp $ */ /* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */ /* @@ -1032,7 +1032,7 @@ iommu_dvmamap_append_range(bus_dma_tag_t t, bus_dmamap_t map, paddr_t pa, sgend = sgstart + length - 1; #ifdef DIAGNOSTIC - if (sgstart == NULL || sgstart >= sgend) { + if (sgstart == NULL || sgstart > sgend) { printf("append range invalid mapping for %lx " "(0x%llx - 0x%llx)\n", pa, sgstart, sgend); map->dm_nsegs = 0; @@ -1481,7 +1481,7 @@ iommu_dvmamap_sync_range(struct strbuf_ctl *sb, vaddr_t va, bus_size_t len) #ifdef DIAGNOSTIC struct iommu_state *is = sb->sb_iommu; - if (va < is->is_dvmabase || va >= is->is_dvmaend) + if (va < is->is_dvmabase || va > is->is_dvmaend) panic("invalid va: %llx", (long long)va); if ((is->is_tsb[IOTSBSLOT(va, is->is_tsbsize)] & IOTTE_STREAM) == 0) { @@ -1495,7 +1495,7 @@ iommu_dvmamap_sync_range(struct strbuf_ctl *sb, vaddr_t va, bus_size_t len) va &= ~PAGE_MASK; #ifdef DIAGNOSTIC - if (va < is->is_dvmabase || vaend >= is->is_dvmaend) + if (va < is->is_dvmabase || vaend > is->is_dvmaend) panic("invalid va range: %llx to %llx (%x to %x)", (long long)va, (long long)vaend, is->is_dvmabase, |