linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hyeonggon Yoo <42.hyeyoo@gmail.com>
To: Ben Luo <luoben@linux.alibaba.com>
Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com,
	iamjoonsoo.kim@lge.com, akpm@linux-foundation.org,
	vbabka@suse.cz, roman.gushchin@linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/slub: return 0 when object pointer is NULL
Date: Mon, 12 Sep 2022 16:18:03 +0900	[thread overview]
Message-ID: <Yx7dKxwxlNmCr9Ai@hyeyoo> (raw)
In-Reply-To: <1662962379-16174-1-git-send-email-luoben@linux.alibaba.com>

On Mon, Sep 12, 2022 at 01:59:39PM +0800, Ben Luo wrote:
> NULL is definitly not a valid address
> 
> Signed-off-by: Ben Luo <luoben@linux.alibaba.com>
> ---
>  mm/slub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 862dbd9..50fad18 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -674,7 +674,7 @@ static inline int check_valid_pointer(struct kmem_cache *s,
>  	void *base;
>  
>  	if (!object)
> -		return 1;
> +		return 0;
>  
>  	base = slab_address(slab);
>  	object = kasan_reset_tag(object);
> -- 
> 1.8.3.1
> 

Hello Ben.

The return value is used to check if the @object has valid pointer
in @slab. (used for debugging) the return value is 0 if valid, 1 if invalid.

It does not return a pointer. So changing it to 0 because 1 is invalid
address does not make sense.

-- 
Thanks,
Hyeonggon


  reply	other threads:[~2022-09-12  7:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12  5:59 Ben Luo
2022-09-12  7:18 ` Hyeonggon Yoo [this message]
2022-09-12  7:29   ` Ben Luo
2022-09-12  7:47     ` Hyeonggon Yoo
2022-09-14  2:11 ` [mm/slub] fb670abe87: BUG_kmem_cache_node(Not_tainted):Freechain_corrupt kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yx7dKxwxlNmCr9Ai@hyeyoo \
    --to=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luoben@linux.alibaba.com \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox