Mesa (gallium-0.1): gallium: new sanity assertions in mmAllocMem()

Brian Paul brianp at kemper.freedesktop.org
Wed Oct 29 23:03:08 UTC 2008


Module: Mesa
Branch: gallium-0.1
Commit: 766cb95a4564c48f35b5180155ab40320a68e371
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=766cb95a4564c48f35b5180155ab40320a68e371

Author: Brian Paul <brian.paul at tungstengraphics.com>
Date:   Wed Oct 29 17:02:56 2008 -0600

gallium: new sanity assertions in mmAllocMem()

---

 src/gallium/auxiliary/util/u_mm.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_mm.c b/src/gallium/auxiliary/util/u_mm.c
index 0f51dd5..01dd67c 100644
--- a/src/gallium/auxiliary/util/u_mm.c
+++ b/src/gallium/auxiliary/util/u_mm.c
@@ -172,6 +172,10 @@ mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
    int startofs = 0;
    int endofs;
 
+   assert(size >= 0);
+   assert(align2 >= 0);
+   assert(align2 <= 12); /* sanity check, 2^12 (4KB) enough? */
+
    if (!heap || align2 < 0 || size <= 0)
       return NULL;
 




More information about the mesa-commit mailing list