diff options
author | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 17:49:17 +1100 |
---|---|---|
committer | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 17:50:16 +1100 |
commit | ccd35fb9f4da856b105ea0f1e0cab3702e8ae6ba (patch) | |
tree | acb71aa4ae7d1f1ed17bdd79033a6bad5e27186d /mm/util.c | |
parent | 786a5e15b613a9cee4fc9139fc3113a5ab0fde79 (diff) | |
download | lwn-ccd35fb9f4da856b105ea0f1e0cab3702e8ae6ba.tar.gz lwn-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 |