diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-04-15 03:09:21 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-04-15 03:09:21 +0000 |
commit | fb805147baefd984fb13f1a42311cba7898c1ead (patch) | |
tree | 83049b58e2f6f7b3b169605de05e9db16f0369ca /sys/dev/pci/agp_i810.c | |
parent | b3853a6bce5868f5aa63c916e63c21bd25a8dba4 (diff) |
Add a bit of sanity-checking paranoia
Diffstat (limited to 'sys/dev/pci/agp_i810.c')
-rw-r--r-- | sys/dev/pci/agp_i810.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/pci/agp_i810.c b/sys/dev/pci/agp_i810.c index 2cb6c37e470..021acdff2c7 100644 --- a/sys/dev/pci/agp_i810.c +++ b/sys/dev/pci/agp_i810.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agp_i810.c,v 1.46 2009/02/17 18:41:32 oga Exp $ */ +/* $OpenBSD: agp_i810.c,v 1.47 2009/04/15 03:09:20 oga Exp $ */ /*- * Copyright (c) 2000 Doug Rabson @@ -669,6 +669,8 @@ agp_i810_bind_memory(void *sc, struct agp_memory *mem, off_t offset) struct agp_i810_softc *isc = sc; u_int32_t regval, i; + if (mem->am_is_bound != 0) + return (EINVAL); /* * XXX evil hack: the PGTBL_CTL appearently gets overwritten by the * X server for mysterious reasons which leads to crashes if we write @@ -710,6 +712,9 @@ agp_i810_unbind_memory(void *sc, struct agp_memory *mem) struct agp_i810_softc *isc = sc; u_int32_t i; + if (mem->am_is_bound == 0) + return (EINVAL); + if (mem->am_type == 2) { for (i = 0; i < mem->am_size; i += AGP_PAGE_SIZE) { WRITE_GATT(mem->am_offset + i, 0); |