[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG_fn=W5Ai_cqhzyi=EBEyhhQtvoQtOsuyfBfRihf=fuKh2Xqw@mail.gmail.com>
Date: Mon, 2 May 2016 12:49:25 +0200
From: Alexander Potapenko <glider@...gle.com>
To: chengang@...ndsoft.com.cn
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Dmitriy Vyukov <dvyukov@...gle.com>,
kasan-dev <kasan-dev@...glegroups.com>,
LKML <linux-kernel@...r.kernel.org>,
Linux Memory Management List <linux-mm@...ck.org>,
Chen Gang <gang.chen.5i5j@...il.com>
Subject: Re: [PATCH] include/linux/kasan.h: Notice about 0 for kasan_[dis/en]able_current()
On Mon, May 2, 2016 at 7:35 AM, <chengang@...ndsoft.com.cn> wrote:
> From: Chen Gang <chengang@...ndsoft.com.cn>
>
> According to their comments and the kasan_depth's initialization, if
> kasan_depth is zero, it means disable. So kasan_depth need consider
> about the 0 overflow.
>
> Also remove useless comments for dummy kasan_slab_free().
>
> Signed-off-by: Chen Gang <gang.chen.5i5j@...il.com>
> ---
> include/linux/kasan.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index 645c280..37fab04 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -32,13 +32,15 @@ static inline void *kasan_mem_to_shadow(const void *addr)
> /* Enable reporting bugs after kasan_disable_current() */
> static inline void kasan_enable_current(void)
> {
> - current->kasan_depth++;
> + if (current->kasan_depth + 1)
> + current->kasan_depth++;
> }
>
> /* Disable reporting bugs for current task */
> static inline void kasan_disable_current(void)
> {
> - current->kasan_depth--;
> + if (current->kasan_depth)
> + current->kasan_depth--;
> }
>
> void kasan_unpoison_shadow(const void *address, size_t size);
> @@ -113,8 +115,6 @@ static inline void kasan_krealloc(const void *object, size_t new_size,
>
> static inline void kasan_slab_alloc(struct kmem_cache *s, void *object,
> gfp_t flags) {}
> -/* kasan_slab_free() returns true if the object has been put into quarantine.
> - */
> static inline bool kasan_slab_free(struct kmem_cache *s, void *object)
> {
> return false;
> --
> 1.9.3
>
Acked-by: Alexander Potapenko <glider@...gle.com>
--
Alexander Potapenko
Software Engineer
Google Germany GmbH
Erika-Mann-Straße, 33
80636 München
Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Powered by blists - more mailing lists