Hi Paul, On Sun, 1 Jun 2008, Paul Mundt wrote:I was about to send a patch that fixes some of the kobjsize() abuses to use ksize() but then I realized that what we probably should do is something like this instead. I mean, assuming the BUG_ON bits are bogus, then we should always pass the pointer to the allocator. I audited most of the callers and they all seem to be really just using kmalloc() for allocation anyway. What do you think? Pekka diff --git a/mm/nommu.c b/mm/nommu.c index dca93fc..fc1ff52 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -103,22 +103,20 @@ EXPORT_SYMBOL(vmtruncate); */ unsigned int kobjsize(const void *objp) { - struct page *page; - /* * If the object we have should not have ksize performed on it, * return size of 0 */ - if (!objp || (unsigned long)objp >= memory_end || !((page = virt_to_page(objp)))) + if (!objp) return 0; - if (PageSlab(page)) - return ksize(objp); + if ((unsigned long)objp >= memory_end) + return 0; - BUG_ON(page->index < 0); - BUG_ON(page->index >= MAX_ORDER); + if (!virt_to_page(objp)) + return 0; - return (PAGE_SIZE << page->index); + return ksize(objp); } /* --
| Faik Uygur | Re: Linux 2.6.21-rc1 |
| pageexec | Re: [stable] Linux 2.6.25.10 |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
git: | |
| Mark Lord | Re: 2.6.25-rc8: FTP transfer errors |
| Natalie Protasevich | [BUG] New Kernel Bugs |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
