git: 584bd868b4e4 - stable/13 - LinuxKPI: fix WRITE_ONCE()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Jun 2023 12:08:34 UTC
The branch stable/13 has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=584bd868b4e41ae909fa0a51bc969be567272427
commit 584bd868b4e41ae909fa0a51bc969be567272427
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-05-13 15:17:47 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-06-26 09:11:49 +0000
LinuxKPI: fix WRITE_ONCE()
Fix a gcc warning: "to be safe all intermediate pointers in cast from
'...' to '...' must be 'const' qualified [-Wcast-qual]".
Doing what is essentially a __DECONST() adding the uintptr_t gets
rid of the massive amount of warnings we get in LinuxKPI and lets
us see the actual problems a lot better.
This is a follow-up to 74e908b3c63b28de1d590dc42502fbe959a6da2e which
fixed READ_ONCE().
Sponsored by: The FreeBSD Foundation
Suggested by: jhb
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D40084
(cherry picked from commit 046d8d89ed1956944b12ec4f0580c30bc202bbfb)
---
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 801618e15f9f..a918b6b76371 100644
--- a/sys/compat/linuxkpi/common/include/linux/compiler.h
+++ b/sys/compat/linuxkpi/common/include/linux/compiler.h
@@ -91,7 +91,7 @@
#define WRITE_ONCE(x,v) do { \
barrier(); \
- ACCESS_ONCE(x) = (v); \
+ (*(volatile __typeof(x) *)(uintptr_t)&(x)) = (v); \
barrier(); \
} while (0)