Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jul 2024 18:45:17 GMT
From:      Ryan Libby <rlibby@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ff1c63671b73 - main - kdb_sysctl_trap: suppress gcc -Warray-bounds
Message-ID:  <202407091845.469IjHgB087533@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=ff1c63671b7372ef7d52da11d02e082876c22654

commit ff1c63671b7372ef7d52da11d02e082876c22654
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2024-07-09 17:58:21 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2024-07-09 17:58:21 +0000

    kdb_sysctl_trap: suppress gcc -Warray-bounds
    
    gcc diagnosed a dereference of 0x10 with -Warray-bounds, which is
    entirely sensible, except that this is a deliberate trap.  Throw gcc off
    with a volatile pointer.
    
    Reviewed by:    kib (previous version)
    Differential Revision:  https://reviews.freebsd.org/D45917
---
 sys/kern/subr_kdb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c
index a7fc2284cbcf..56264a96c9fa 100644
--- a/sys/kern/subr_kdb.c
+++ b/sys/kern/subr_kdb.c
@@ -238,7 +238,7 @@ static int
 kdb_sysctl_trap(SYSCTL_HANDLER_ARGS)
 {
 	int error, i;
-	int *addr = (int *)0x10;
+	int *volatile addr = (int *)0x10;
 
 	error = sysctl_wire_old_buffer(req, sizeof(int));
 	if (error == 0) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407091845.469IjHgB087533>