Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Matthieu Baerts <matthieu.baerts@tessares.net>
To: stable@vger.kernel.org
Cc: asmadeus@codewreck.org, sashal@kernel.org,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Matthieu Baerts <matthieu.baerts@tessares.net>
Subject: [PATCH 1/3] compiler.h, kasan: Avoid duplicating __read_once_size_nocheck()
Date: Wed, 24 Jul 2019 22:55:55 +0200	[thread overview]
Message-ID: <20190724205557.30913-2-matthieu.baerts@tessares.net> (raw)
In-Reply-To: <20190724205557.30913-1-matthieu.baerts@tessares.net>

From: Andrey Ryabinin <aryabinin@virtuozzo.com>

commit bdb5ac801af3d81d36732c2f640d6a1d3df83826 upstream.

Instead of having two identical __read_once_size_nocheck() functions
with different attributes, consolidate all the difference in new macro
__no_kasan_or_inline and use it. No functional changes.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 include/linux/compiler.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index a704d032713b..f490d8d93ec3 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -185,23 +185,21 @@ void __read_once_size(const volatile void *p, void *res, int size)
 
 #ifdef CONFIG_KASAN
 /*
- * This function is not 'inline' because __no_sanitize_address confilcts
+ * We can't declare function 'inline' because __no_sanitize_address confilcts
  * with inlining. Attempt to inline it may cause a build failure.
  * 	https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
  * '__maybe_unused' allows us to avoid defined-but-not-used warnings.
  */
-static __no_sanitize_address __maybe_unused
-void __read_once_size_nocheck(const volatile void *p, void *res, int size)
-{
-	__READ_ONCE_SIZE;
-}
+# define __no_kasan_or_inline __no_sanitize_address __maybe_unused
 #else
-static __always_inline
+# define __no_kasan_or_inline __always_inline
+#endif
+
+static __no_kasan_or_inline
 void __read_once_size_nocheck(const volatile void *p, void *res, int size)
 {
 	__READ_ONCE_SIZE;
 }
-#endif
 
 static __always_inline void __write_once_size(volatile void *p, void *res, int size)
 {
-- 
2.20.1


  reply	other threads:[~2019-07-24 20:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24 20:55 [PATCH 0/3] Backport request for v4.14 to fix KASAN issues Matthieu Baerts
2019-07-24 20:55 ` Matthieu Baerts [this message]
2019-07-24 20:55 ` [PATCH 2/3] compiler.h: Add read_word_at_a_time() function Matthieu Baerts
2019-07-24 20:55 ` [PATCH 3/3] lib/strscpy: Shut up KASAN false-positives in strscpy() Matthieu Baerts
2019-07-25  4:18 ` [PATCH 0/3] Backport request for v4.14 to fix KASAN issues Sasha Levin
2019-07-25  9:38   ` Matthieu Baerts

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=20190724205557.30913-2-matthieu.baerts@tessares.net \
    --to=matthieu.baerts@tessares.net \
    --cc=aryabinin@virtuozzo.com \
    --cc=asmadeus@codewreck.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.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