diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-12-30 19:15:31 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-12-30 19:15:31 +0000 |
commit | 6ed929ce8f64b1846e8ede56438a61769322306d (patch) | |
tree | e536dccd029db9efa5c30b328d1a04588634dbe4 | |
parent | b97c60733be1ce1224e2691b1404ec99ecc331f0 (diff) |
In agp_generic_alloc_memory(), make sure the age_mem structure freshly
malloc'ed is completely bzeroed before use.
ok deraadt@
-rw-r--r-- | sys/dev/pci/agp.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/dev/pci/agp.c b/sys/dev/pci/agp.c index 776aab76f1a..91d764a933f 100644 --- a/sys/dev/pci/agp.c +++ b/sys/dev/pci/agp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agp.c,v 1.1 2006/03/16 21:32:34 matthieu Exp $ */ +/* $OpenBSD: agp.c,v 1.2 2006/12/30 19:15:30 miod Exp $ */ /*- * Copyright (c) 2000 Doug Rabson * All rights reserved. @@ -474,6 +474,7 @@ agp_generic_alloc_memory(struct vga_pci_softc *sc, int type, vsize_t size) mem = malloc(sizeof *mem, M_DEVBUF, M_WAITOK); if (mem == NULL) return NULL; + bzero(mem, sizeof *mem); if (bus_dmamap_create(sc->sc_dmat, size, size / PAGE_SIZE + 1, size, 0, BUS_DMA_NOWAIT, &mem->am_dmamap) != 0) { @@ -483,10 +484,6 @@ agp_generic_alloc_memory(struct vga_pci_softc *sc, int type, vsize_t size) mem->am_id = sc->sc_nextid++; mem->am_size = size; - mem->am_type = 0; - mem->am_physical = 0; - mem->am_offset = 0; - mem->am_is_bound = 0; TAILQ_INSERT_TAIL(&sc->sc_memory, mem, am_link); sc->sc_allocated += size; |