summaryrefslogtreecommitdiff
path: root/nvkm/core
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@canonical.com>2013-08-12 12:41:34 +0200
committerBen Skeggs <bskeggs@redhat.com>2013-08-21 11:34:23 +1000
commitf1e6f23c3e8d4ccabba602b782c0c58dbbb26c82 (patch)
tree8f96a4075e8f53ec5dfe5e743f30e02a4ffe8df7 /nvkm/core
parent31d0e5c5477dd5a6ab89b102678717963306b007 (diff)
downloadnouveau-f1e6f23c3e8d4ccabba602b782c0c58dbbb26c82.tar.gz
ltcg: fix allocating memory as free
Allocating type=0 marks the memory as free. This allows the ltcg memory to be allocated twice. Add a BUG_ON in core/mm.c to prevent this ever happening again. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'nvkm/core')
-rw-r--r--nvkm/core/mm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/nvkm/core/mm.c b/nvkm/core/mm.c
index d8291724d..7a4e0891c 100644
--- a/nvkm/core/mm.c
+++ b/nvkm/core/mm.c
@@ -98,6 +98,8 @@ nouveau_mm_head(struct nouveau_mm *mm, u8 type, u32 size_max, u32 size_min,
u32 splitoff;
u32 s, e;
+ BUG_ON(!type);
+
list_for_each_entry(this, &mm->free, fl_entry) {
e = this->offset + this->length;
s = this->offset;
@@ -162,6 +164,8 @@ nouveau_mm_tail(struct nouveau_mm *mm, u8 type, u32 size_max, u32 size_min,
struct nouveau_mm_node *prev, *this, *next;
u32 mask = align - 1;
+ BUG_ON(!type);
+
list_for_each_entry_reverse(this, &mm->free, fl_entry) {
u32 e = this->offset + this->length;
u32 s = this->offset;