diff options
author | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 07:49:17 +0100 |
---|---|---|
committer | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 07:50:16 +0100 |
commit | ccd35fb9f4da856b105ea0f1e0cab3702e8ae6ba (patch) | |
tree | acb71aa4ae7d1f1ed17bdd79033a6bad5e27186d /mm/util.c | |
parent | fs: d_validate fixes (diff) | |
download | linux-ccd35fb9f4da856b105ea0f1e0cab3702e8ae6ba.tar.xz linux-ccd35fb9f4da856b105ea0f1e0cab3702e8ae6ba.zip |
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/util.c')
-rw-r--r-- | mm/util.c | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/mm/util.c b/mm/util.c index 73dac81e9f78..f126975ef23e 100644 --- a/mm/util.c +++ b/mm/util.c @@ -186,27 +186,6 @@ void kzfree(const void *p) } EXPORT_SYMBOL(kzfree); -int kern_ptr_validate(const void *ptr, unsigned long size) -{ - unsigned long addr = (unsigned long)ptr; - unsigned long min_addr = PAGE_OFFSET; - unsigned long align_mask = sizeof(void *) - 1; - - if (unlikely(addr < min_addr)) - goto out; - if (unlikely(addr > (unsigned long)high_memory - size)) - goto out; - if (unlikely(addr & align_mask)) - goto out; - if (unlikely(!kern_addr_valid(addr))) - goto out; - if (unlikely(!kern_addr_valid(addr + size - 1))) - goto out; - return 1; -out: - return 0; -} - /* * strndup_user - duplicate an existing string from user space * @s: The string to duplicate |