[PATCH 1/2] x86/hw_breakpoint: Remove misleading ERR_PTR() cast

From: Habil Eren Türker

Date: Sun Sep 27 2026 - 10:29:21 EST


args->err holds the address of the DR6 value, not an error pointer.

Using ERR_PTR here is misleading and produces a false-positive from Smatch:

arch/x86/kernel/hw_breakpoint.c:521 hw_breakpoint_handler()
error: 'dr6_p' dereferencing possible ERR_PTR()

ERR_PTR is defined as a plain (void *) cast. So the compiler generates
identical code with or without it.

No functional change.

Signed-off-by: Habil Eren Türker <habilerenturker@xxxxxxxxxxx>
---
arch/x86/kernel/hw_breakpoint.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
index f846c15f2..f142d868e 100644
--- a/arch/x86/kernel/hw_breakpoint.c
+++ b/arch/x86/kernel/hw_breakpoint.c
@@ -517,7 +517,7 @@ static int hw_breakpoint_handler(struct die_args *args)
bool bpx;

/* The DR6 value is pointed by args->err */
- dr6_p = (unsigned long *)ERR_PTR(args->err);
+ dr6_p = (unsigned long *)args->err;
dr6 = *dr6_p;

/* Do an early return if no trap bits are set in DR6 */
--
2.47.3