Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 131840
b: refs/heads/master
c: 7766970
h: refs/heads/master
v: v3
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Feb 28, 2009
1 parent 7aaa654 commit 521aec3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5170836679185357dc1b7660bad13287b39e1e33
refs/heads/master: 7766970cc13e9071b356b1f2a48a9eb8675bfcce
7 changes: 7 additions & 0 deletions trunk/mm/vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
unsigned long addr;
int purged = 0;

BUG_ON(!size);
BUG_ON(size & ~PAGE_MASK);

va = kmalloc_node(sizeof(struct vmap_area),
Expand All @@ -334,6 +335,9 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
addr = ALIGN(vstart, align);

spin_lock(&vmap_area_lock);
if (addr + size - 1 < addr)
goto overflow;

/* XXX: could have a last_hole cache */
n = vmap_area_root.rb_node;
if (n) {
Expand Down Expand Up @@ -365,6 +369,8 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,

while (addr + size > first->va_start && addr + size <= vend) {
addr = ALIGN(first->va_end + PAGE_SIZE, align);
if (addr + size - 1 < addr)
goto overflow;

n = rb_next(&first->rb_node);
if (n)
Expand All @@ -375,6 +381,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
}
found:
if (addr + size > vend) {
overflow:
spin_unlock(&vmap_area_lock);
if (!purged) {
purge_vmap_area_lazy();
Expand Down

0 comments on commit 521aec3

Please sign in to comment.