git: 6095f4b04cf9 - main - amd64 kernel __storeload_barrier: quiet gcc -Warray-bounds
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 23 Jun 2024 23:24:42 UTC
The branch main has been updated by rlibby:
URL: https://cgit.FreeBSD.org/src/commit/?id=6095f4b04cf9714a3b66fc5906fcfc5ec2a8ddd6
commit 6095f4b04cf9714a3b66fc5906fcfc5ec2a8ddd6
Author: Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2024-06-23 23:23:14 +0000
Commit: Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2024-06-23 23:23:14 +0000
amd64 kernel __storeload_barrier: quiet gcc -Warray-bounds
Use a constant input operand instead of an output operand to tell the
compiler about OFFSETOF_MONITORBUF. If we tell it we are writing to
*(u_int *)OFFSETOF_MONITORBUF, it rightly complains, but we aren't. The
memory clobber already covers the necessary semantics for the compiler.
Reviewed by: kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D45694
---
sys/amd64/include/atomic.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/amd64/include/atomic.h b/sys/amd64/include/atomic.h
index facf6da844d3..75a88e03290e 100644
--- a/sys/amd64/include/atomic.h
+++ b/sys/amd64/include/atomic.h
@@ -295,8 +295,8 @@ static __inline void
__storeload_barrier(void)
{
#if defined(_KERNEL)
- __asm __volatile("lock; addl $0,%%gs:%0"
- : "+m" (*(u_int *)OFFSETOF_MONITORBUF) : : "memory", "cc");
+ __asm __volatile("lock; addl $0,%%gs:%c0"
+ : : "i" (OFFSETOF_MONITORBUF) : "memory", "cc");
#else /* !_KERNEL */
__asm __volatile("lock; addl $0,-8(%%rsp)" : : : "memory", "cc");
#endif /* _KERNEL*/