From: Yosry Ahmed <yosry@kernel.org>
To: Paolo Bonzini <pbonzini@redhat.com>,
Thomas Huth <thuth@redhat.com>,
Andrew Jones <andrew.jones@linux.dev>
Cc: Greg Thelen <gthelen@google.com>,
kvm@vger.kernel.org, Yosry Ahmed <yosry@kernel.org>
Subject: [kvm-unit-tests PATCH 2/2] x86/desc: Remove unused exception flag
Date: Thu, 22 Oct 2026 20:44:13 +0000 [thread overview]
Message-ID: <20261022204413.856786-3-yosry@kernel.org> (raw)
In-Reply-To: <20261022204413.856786-1-yosry@kernel.org>
exception is set to true in exception_handler() but is never read
because exception recovery redirects regs->rip to
exception_handler_longjmp(). Clang 24 warns on this with
-Wunused-but-set-global:
lib/x86/desc.c:483:13: error: variable 'exception' set but not used
[-Werror,-Wunused-but-set-global]
Remove the unused variable.
Fixes: 932ba2d2f530 ("x86: simplify test_for_exception trigger functions")
Co-developed-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Yosry Ahmed <yosry@kernel.org>
---
lib/x86/desc.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/lib/x86/desc.c b/lib/x86/desc.c
index f4cdfbc92c560..b5d4056260a1d 100644
--- a/lib/x86/desc.c
+++ b/lib/x86/desc.c
@@ -480,7 +480,6 @@ void setup_alt_stack(void)
}
#endif
-static bool exception;
static jmp_buf *exception_jmpbuf;
static void exception_handler_longjmp(void)
@@ -491,7 +490,6 @@ static void exception_handler_longjmp(void)
static void exception_handler(struct ex_regs *regs)
{
/* longjmp must happen after iret, so do not do it now. */
- exception = true;
regs->rip = (unsigned long)&exception_handler_longjmp;
regs->cs = read_cs();
}
--
2.56.0.257.gf7497c7d27-goog
prev parent reply other threads:[~2026-10-22 20:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 20:44 [kvm-unit-tests PATCH 0/2] Fix Clang 24 -Wunused-but-set-global warnings Yosry Ahmed
2026-10-22 20:44 ` [kvm-unit-tests PATCH 1/2] chr-testdev: Remove unused in_vq Yosry Ahmed
2026-10-23 9:58 ` Andrew Jones
2026-10-22 20:44 ` Yosry Ahmed [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261022204413.856786-3-yosry@kernel.org \
--to=yosry@kernel.org \
--cc=andrew.jones@linux.dev \
--cc=gthelen@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.