[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1613971347-24213-1-git-send-email-daizhiyuan@phytium.com.cn>
Date: Mon, 22 Feb 2021 13:22:27 +0800
From: Zhiyuan Dai <daizhiyuan@...tium.com.cn>
To: ryabinin.a.a@...il.com, glider@...gle.com, andreyknvl@...il.com,
dvyukov@...gle.com, akpm@...ux-foundation.org
Cc: kasan-dev@...glegroups.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Zhiyuan Dai <daizhiyuan@...tium.com.cn>
Subject: [PATCH] mm/kasan: remove volatile keyword
Like volatile, the kernel primitives which make concurrent
access to data safe (spinlocks, mutexes, memory barriers,
etc.) are designed to prevent unwanted optimization.
If they are being used properly, there will be no need to
use volatile as well. If volatile is still necessary,
there is almost certainly a bug in the code somewhere.
In properly-written kernel code, volatile can only serve
to slow things down.
see: Documentation/process/volatile-considered-harmful.rst
Signed-off-by: Zhiyuan Dai <daizhiyuan@...tium.com.cn>
---
mm/kasan/shadow.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c
index 7c2c08c..d5ff9ca 100644
--- a/mm/kasan/shadow.c
+++ b/mm/kasan/shadow.c
@@ -25,13 +25,13 @@
#include "kasan.h"
-bool __kasan_check_read(const volatile void *p, unsigned int size)
+bool __kasan_check_read(const void *p, unsigned int size)
{
return check_memory_region((unsigned long)p, size, false, _RET_IP_);
}
EXPORT_SYMBOL(__kasan_check_read);
-bool __kasan_check_write(const volatile void *p, unsigned int size)
+bool __kasan_check_write(const void *p, unsigned int size)
{
return check_memory_region((unsigned long)p, size, true, _RET_IP_);
}
--
1.8.3.1
Powered by blists - more mailing lists