diff options
-rw-r--r-- | mm/nommu.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mm/nommu.c b/mm/nommu.c index a6e8ccfbd400..60ed8375c986 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -149,6 +149,20 @@ unsigned int kobjsize(const void *objp) | |||
149 | return ksize(objp); | 149 | return ksize(objp); |
150 | 150 | ||
151 | /* | 151 | /* |
152 | * If it's not a compound page, see if we have a matching VMA | ||
153 | * region. This test is intentionally done in reverse order, | ||
154 | * so if there's no VMA, we still fall through and hand back | ||
155 | * PAGE_SIZE for 0-order pages. | ||
156 | */ | ||
157 | if (!PageCompound(page)) { | ||
158 | struct vm_area_struct *vma; | ||
159 | |||
160 | vma = find_vma(current->mm, (unsigned long)objp); | ||
161 | if (vma) | ||
162 | return vma->vm_end - vma->vm_start; | ||
163 | } | ||
164 | |||
165 | /* | ||
152 | * The ksize() function is only guaranteed to work for pointers | 166 | * The ksize() function is only guaranteed to work for pointers |
153 | * returned by kmalloc(). So handle arbitrary pointers here. | 167 | * returned by kmalloc(). So handle arbitrary pointers here. |
154 | */ | 168 | */ |