Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=abcd08a6f564171ffa05bc77d1c2ba4cfa949653
Commit:     abcd08a6f564171ffa05bc77d1c2ba4cfa949653
Parent:     a87615b8f9e2349f6d3770af3d72fd6a41ab4239
Author:     Christoph Lameter <[EMAIL PROTECTED]>
AuthorDate: Wed May 9 02:32:37 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed May 9 12:30:44 2007 -0700

    SLUB: use check_valid_pointer in kmem_ptr_validate
    
    We needlessly duplicate code. Also make check_valid_pointer inline.
    
    Signed-off-by: Christoph LAemter <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 mm/slub.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index beac34a..1832ae1 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -405,9 +405,8 @@ static int check_bytes(u8 *start, unsigned int value, 
unsigned int bytes)
        return 1;
 }
 
-
-static int check_valid_pointer(struct kmem_cache *s, struct page *page,
-                                        void *object)
+static inline int check_valid_pointer(struct kmem_cache *s,
+                               struct page *page, const void *object)
 {
        void *base;
 
@@ -1796,13 +1795,7 @@ int kmem_ptr_validate(struct kmem_cache *s, const void 
*object)
                /* No slab or wrong slab */
                return 0;
 
-       addr = page_address(page);
-       if (object < addr || object >= addr + s->objects * s->size)
-               /* Out of bounds */
-               return 0;
-
-       if ((object - addr) % s->size)
-               /* Improperly aligned */
+       if (!check_valid_pointer(s, page, object))
                return 0;
 
        /*
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to