git: 38f969d41c54 - stable/13 - LinuxKPI: fix READ_ONCE() -Wcast-equal warnings
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Jun 2023 12:08:33 UTC
The branch stable/13 has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=38f969d41c5487f61fdf03dcc95c1cff0ec679cc
commit 38f969d41c5487f61fdf03dcc95c1cff0ec679cc
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-04-19 21:43:59 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-06-26 09:09:53 +0000
LinuxKPI: fix READ_ONCE() -Wcast-equal warnings
Rather than using ACCESS_ONCE() in READ_ONCE() add a missing cast
to const in order to satisfy -Wcast-equal by gcc.
Sadly we cannot do the same to WRITE_ONCE() which still is very
noisy.
Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D39706
(cherry picked from commit 74e908b3c63b28de1d590dc42502fbe959a6da2e)
---
sys/compat/linuxkpi/common/include/linux/compiler.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h
index 87a37228736f..801618e15f9f 100644
--- a/sys/compat/linuxkpi/common/include/linux/compiler.h
+++ b/sys/compat/linuxkpi/common/include/linux/compiler.h
@@ -98,7 +98,7 @@
#define READ_ONCE(x) ({ \
__typeof(x) __var = ({ \
barrier(); \
- ACCESS_ONCE(x); \
+ (*(const volatile __typeof(x) *)&(x)); \
}); \
barrier(); \
__var; \