Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amd64/amd64 - promote regs from int to u_int in com...



details:   https://anonhg.NetBSD.org/src/rev/a3f73c20496b
branches:  trunk
changeset: 965650:a3f73c20496b
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Sep 26 01:39:22 2019 +0000

description:
- promote regs from int to u_int in comparisons with unsigned constants
- cast -1 to __greg32_t which is unsigned and the LHS.

diffstat:

 sys/arch/amd64/amd64/netbsd32_machdep.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r 20fd911ce676 -r a3f73c20496b sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c   Thu Sep 26 01:37:52 2019 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c   Thu Sep 26 01:39:22 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.127 2019/08/21 12:46:56 maxv Exp $      */
+/*     $NetBSD: netbsd32_machdep.c,v 1.128 2019/09/26 01:39:22 christos Exp $  */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.127 2019/08/21 12:46:56 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.128 2019/09/26 01:39:22 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -437,7 +437,7 @@
        if (!VALID_USER_DSEL32(regs->r_ds) ||
            !VALID_USER_DSEL32(regs->r_ss))
                return EINVAL;
-       if (regs->r_eip >= VM_MAXUSER_ADDRESS32)
+       if ((u_int)regs->r_eip >= VM_MAXUSER_ADDRESS32)
                return EINVAL;
 
        tf->tf_rax = regs->r_eax;
@@ -479,7 +479,7 @@
 
        /* Check that DR0-DR3 contain user-space address */
        for (i = 0; i < X86_DBREGS; i++) {
-               if (regs->dr[i] >= VM_MAXUSER_ADDRESS32)
+               if ((u_int)regs->dr[i] >= VM_MAXUSER_ADDRESS32)
                        return EINVAL;
        }
 
@@ -811,7 +811,7 @@
        gr[_REG32_ERR]    = tf->tf_err;
 
        if ((ras_eip = (__greg32_t)(uintptr_t)ras_lookup(l->l_proc,
-           (void *) (uintptr_t)gr[_REG32_EIP])) != -1)
+           (void *) (uintptr_t)gr[_REG32_EIP])) != (__greg32_t)-1)
                gr[_REG32_EIP] = ras_eip;
 
        *flags |= _UC_CPU;



Home | Main Index | Thread Index | Old Index