Module Name:    src
Committed By:   rin
Date:           Tue Jun 18 13:29:56 UTC 2024

Modified Files:
        src/sys/arch/aarch64/aarch64: netbsd32_machdep.c

Log Message:
aarch64: cpu_getmcontext32: Fix sign compare for ras_lookup(9)

Now, compare with `(void *)-1` is done for x0, instead of w0.
No binary changes except for that.

Found by WARNS=5 build (as a module).


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/aarch64/aarch64/netbsd32_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/aarch64/aarch64/netbsd32_machdep.c
diff -u src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.24 src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.25
--- src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.24	Wed Feb  7 04:20:26 2024
+++ src/sys/arch/aarch64/aarch64/netbsd32_machdep.c	Tue Jun 18 13:29:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.24 2024/02/07 04:20:26 msaitoh Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.25 2024/06/18 13:29:56 rin Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.24 2024/02/07 04:20:26 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.25 2024/06/18 13:29:56 rin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -424,7 +424,7 @@ cpu_getmcontext32(struct lwp *l, mcontex
 {
 	struct trapframe * const tf = lwp_trapframe(l);
 	__greg32_t *gr = mcp->__gregs;
-	__greg32_t ras_pc;
+	void *ras_pc;
 
 	gr[_REG_R0]  = tf->tf_reg[0];
 	gr[_REG_R1]  = tf->tf_reg[1];
@@ -444,9 +444,9 @@ cpu_getmcontext32(struct lwp *l, mcontex
 	gr[_REG_R15] = tf->tf_pc;
 	gr[_REG_CPSR] = tf->tf_spsr;
 
-	if ((ras_pc = (__greg32_t)(uintptr_t)ras_lookup(l->l_proc,
-	    (void *)(uintptr_t)gr[_REG_R15])) != -1) {
-		gr[_REG_R15] = ras_pc;
+	ras_pc = ras_lookup(l->l_proc, (void *)(uintptr_t)gr[_REG_R15]);
+	if (ras_pc != (void *)-1) {
+		gr[_REG_R15] = (__greg32_t)(uintptr_t)ras_pc;
 	}
 	*flagsp |= _UC_CPU;
 

Reply via email to