linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: Matthew Wilcox <willy@infradead.org>
Cc: catalin.marinas@arm.com, will@kernel.org, andreyknvl@google.com,
	 aryabinin@virtuozzo.com, glider@google.com, dvyukov@google.com,
	 linux-arm-kernel@lists.infradead.org,
	kasan-dev@googlegroups.com,  linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] arm64/mm: fix variable 'tag' set but not used
Date: Thu, 01 Aug 2019 12:20:34 -0400	[thread overview]
Message-ID: <1564676434.11067.46.camel@lca.pw> (raw)
In-Reply-To: <20190801160013.GK4700@bombadil.infradead.org>

On Thu, 2019-08-01 at 09:00 -0700, Matthew Wilcox wrote:
> On Thu, Aug 01, 2019 at 10:47:05AM -0400, Qian Cai wrote:
> 
> Given this:
> 
> > -#define __tag_set(addr, tag)	(addr)
> > +static inline const void *__tag_set(const void *addr, u8 tag)
> > +{
> > +	return addr;
> > +}
> > +
> >  #define __tag_reset(addr)	(addr)
> >  #define __tag_get(addr)		0
> >  #endif
> > @@ -301,8 +305,8 @@ static inline void *phys_to_virt(phys_addr_t x)
> >  #define page_to_virt(page)	({					
> > \
> >  	unsigned long __addr =						
> > \
> >  		((__page_to_voff(page)) | PAGE_OFFSET);			
> > \
> > -	unsigned long __addr_tag =					\
> > -		 __tag_set(__addr, page_kasan_tag(page));		\
> > +	const void *__addr_tag =					\
> > +		__tag_set((void *)__addr, page_kasan_tag(page));	\
> >  	((void *)__addr_tag);						
> > \
> >  })
> 
> Can't you simplify that macro to:
> 
>  #define page_to_virt(page)	({					\
>  	unsigned long __addr =						
> \
>  		((__page_to_voff(page)) | PAGE_OFFSET);			
> \
> -	unsigned long __addr_tag =					\
> -		 __tag_set(__addr, page_kasan_tag(page));		\
> -	((void *)__addr_tag);						
> \
> +	__tag_set((void *)__addr, page_kasan_tag(page));		\
>  })

It still need a cast or lowmem_page_address() will complain of a discarded
"const". It might be a bit harder to read when adding a cast as in,

((void *)__tag_set((void *)__addr, page_kasan_tag(page)));

But, that feel like more of a followup patch for me if ever needed.


  reply	other threads:[~2019-08-01 16:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01 14:47 Qian Cai
2019-08-01 16:00 ` Matthew Wilcox
2019-08-01 16:20   ` Qian Cai [this message]
2019-08-05 15:37 ` Andrey Konovalov

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=1564676434.11067.46.camel@lca.pw \
    --to=cai@lca.pw \
    --cc=andreyknvl@google.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=catalin.marinas@arm.com \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=will@kernel.org \
    --cc=willy@infradead.org \
    /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