diff options
author | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:49:17 -0500 |
---|---|---|
committer | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:50:16 -0500 |
commit | ccd35fb9f4da856b105ea0f1e0cab3702e8ae6ba (patch) | |
tree | acb71aa4ae7d1f1ed17bdd79033a6bad5e27186d /mm/slub.c | |
parent | 786a5e15b613a9cee4fc9139fc3113a5ab0fde79 (diff) |
kernel: kmem_ptr_validate considered harmful
This is a nasty and error prone API. It is no longer used, remove it.
Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 40 |
1 files changed, 0 insertions, 40 deletions
@@ -1917,17 +1917,6 @@ void kmem_cache_free(struct kmem_cache *s, void *x) | |||
1917 | } | 1917 | } |
1918 | EXPORT_SYMBOL(kmem_cache_free); | 1918 | EXPORT_SYMBOL(kmem_cache_free); |
1919 | 1919 | ||
1920 | /* Figure out on which slab page the object resides */ | ||
1921 | static struct page *get_object_page(const void *x) | ||
1922 | { | ||
1923 | struct page *page = virt_to_head_page(x); | ||
1924 | |||
1925 | if (!PageSlab(page)) | ||
1926 | return NULL; | ||
1927 | |||
1928 | return page; | ||
1929 | } | ||
1930 | |||
1931 | /* | 1920 | /* |
1932 | * Object placement in a slab is made very easy because we always start at | 1921 | * Object placement in a slab is made very easy because we always start at |
1933 | * offset 0. If we tune the size of the object to the alignment then we can | 1922 | * offset 0. If we tune the size of the object to the alignment then we can |
@@ -2386,35 +2375,6 @@ error: | |||
2386 | } | 2375 | } |
2387 | 2376 | ||
2388 | /* | 2377 | /* |
2389 | * Check if a given pointer is valid | ||
2390 | */ | ||
2391 | int kmem_ptr_validate(struct kmem_cache *s, const void *object) | ||
2392 | { | ||
2393 | struct page *page; | ||
2394 | |||
2395 | if (!kern_ptr_validate(object, s->size)) | ||
2396 | return 0; | ||
2397 | |||
2398 | page = get_object_page(object); | ||
2399 | |||
2400 | if (!page || s != page->slab) | ||
2401 | /* No slab or wrong slab */ | ||
2402 | return 0; | ||
2403 | |||
2404 | if (!check_valid_pointer(s, page, object)) | ||
2405 | return 0; | ||
2406 | |||
2407 | /* | ||
2408 | * We could also check if the object is on the slabs freelist. | ||
2409 | * But this would be too expensive and it seems that the main | ||
2410 | * purpose of kmem_ptr_valid() is to check if the object belongs | ||
2411 | * to a certain slab. | ||
2412 | */ | ||
2413 | return 1; | ||
2414 | } | ||
2415 | EXPORT_SYMBOL(kmem_ptr_validate); | ||
2416 | |||
2417 | /* | ||
2418 | * Determine the size of a slab object | 2378 | * Determine the size of a slab object |
2419 | */ | 2379 | */ |
2420 | unsigned int kmem_cache_size(struct kmem_cache *s) | 2380 | unsigned int kmem_cache_size(struct kmem_cache *s) |