kasan, slab: remove redundant kasan_slab_alloc hooks [Linux 5.0]

kasan, slab: remove redundant kasan_slab_alloc hooks [Linux 5.0]

This Linux kernel change "kasan, slab: remove redundant kasan_slab_alloc hooks" is included in the Linux 5.0 release. This change is authored by Andrey Konovalov <andreyknvl [at] google.com> on Wed Feb 20 22:20:33 2019 -0800. The commit for this change in Linux stable tree is 557ea25 (patch).

kasan, slab: remove redundant kasan_slab_alloc hooks

kasan_slab_alloc() calls in kmem_cache_alloc() and kmem_cache_alloc_node()
are redundant as they are already called via slab_alloc/slab_alloc_node()->
slab_post_alloc_hook()->kasan_slab_alloc().  Remove them.

Link: http://lkml.kernel.org/r/4ca[email protected]google.com
Signed-off-by: Andrey Konovalov <[email protected]>
Tested-by: Qian Cai <[email protected]>
Cc: Alexander Potapenko <[email protected]>
Cc: Andrey Ryabinin <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Cc: Evgeniy Stepanov <[email protected]>
Cc: Kostya Serebryany <[email protected]>
Cc: Vincenzo Frascino <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 mm/slab.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 4ad95fc..91c1863 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3547,7 +3547,6 @@ void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
 {
    void *ret = slab_alloc(cachep, flags, _RET_IP_);

-   ret = kasan_slab_alloc(cachep, ret, flags);
    trace_kmem_cache_alloc(_RET_IP_, ret,
                   cachep->object_size, cachep->size, flags);

@@ -3637,7 +3636,6 @@ void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid)
 {
    void *ret = slab_alloc_node(cachep, flags, nodeid, _RET_IP_);

-   ret = kasan_slab_alloc(cachep, ret, flags);
    trace_kmem_cache_alloc_node(_RET_IP_, ret,
                    cachep->object_size, cachep->size,
                    flags, nodeid);

Leave a Reply

Your email address will not be published. Required fields are marked *