Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98025
b: refs/heads/master
c: 5a1603b
h: refs/heads/master
i:
  98023: f42e7e5
v: v3
  • Loading branch information
Paul Mundt authored and Linus Torvalds committed Jun 12, 2008
1 parent 4aa7a08 commit 7cd20e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f969c5672b16b857e5231ad3c78f08d8ef3305aa
refs/heads/master: 5a1603be58f11edb1b30cb1e40cfbdd4439289d0
21 changes: 3 additions & 18 deletions trunk/mm/nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,15 @@ EXPORT_SYMBOL(vmtruncate);
unsigned int kobjsize(const void *objp)
{
struct page *page;
int order = 0;

/*
* If the object we have should not have ksize performed on it,
* return size of 0
*/
if (!objp)
return 0;

if ((unsigned long)objp >= memory_end)
if (!objp || !virt_addr_valid(objp))
return 0;

page = virt_to_head_page(objp);
if (!page)
return 0;

/*
* If the allocator sets PageSlab, we know the pointer came from
Expand All @@ -129,18 +123,9 @@ unsigned int kobjsize(const void *objp)

/*
* The ksize() function is only guaranteed to work for pointers
* returned by kmalloc(). So handle arbitrary pointers, that we expect
* always to be compound pages, here.
*/
if (PageCompound(page))
order = compound_order(page);

/*
* Finally, handle arbitrary pointers that don't set PageSlab.
* Default to 0-order in the case when we're unable to ksize()
* the object.
* returned by kmalloc(). So handle arbitrary pointers here.
*/
return PAGE_SIZE << order;
return PAGE_SIZE << compound_order(page);
}

/*
Expand Down

0 comments on commit 7cd20e1

Please sign in to comment.