Source-Changes-HG archive

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

[src/trunk]: src/sys/kern (off_t)(long) is wrong when it comes to kernel addr...



details:   https://anonhg.NetBSD.org/src/rev/9f468d33b403
branches:  trunk
changeset: 566968:9f468d33b403
user:      christos <christos%NetBSD.org@localhost>
date:      Wed May 26 16:28:05 2004 +0000

description:
(off_t)(long) is wrong when it comes to kernel addresses [because on a 32 bit
machine if the high bit is set they turn negative]. Make an intermediate cast
to unsigned long.

diffstat:

 sys/kern/init_sysctl.c   |  6 +++---
 sys/kern/kern_systrace.c |  6 +++---
 sys/kern/sys_process.c   |  8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)

diffs (90 lines):

diff -r 962c3f57481b -r 9f468d33b403 sys/kern/init_sysctl.c
--- a/sys/kern/init_sysctl.c    Wed May 26 15:03:19 2004 +0000
+++ b/sys/kern/init_sysctl.c    Wed May 26 16:28:05 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_sysctl.c,v 1.29 2004/05/03 13:39:50 martin Exp $ */
+/*     $NetBSD: init_sysctl.c,v 1.30 2004/05/26 16:28:05 christos Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.29 2004/05/03 13:39:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.30 2004/05/26 16:28:05 christos Exp $");
 
 #include "opt_sysv.h"
 #include "opt_multiprocessor.h"
@@ -2132,7 +2132,7 @@
        default:
                return (EINVAL);
        }
-       auio.uio_offset = (off_t)(long)tmp;
+       auio.uio_offset = (off_t)(unsigned long)tmp;
        aiov.iov_base = &argv;
        aiov.iov_len = sizeof(argv);
        auio.uio_iov = &aiov;
diff -r 962c3f57481b -r 9f468d33b403 sys/kern/kern_systrace.c
--- a/sys/kern/kern_systrace.c  Wed May 26 15:03:19 2004 +0000
+++ b/sys/kern/kern_systrace.c  Wed May 26 16:28:05 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_systrace.c,v 1.39 2004/04/25 16:42:41 simonb Exp $        */
+/*     $NetBSD: kern_systrace.c,v 1.40 2004/05/26 16:28:05 christos Exp $      */
 
 /*
  * Copyright 2002, 2003 Niels Provos <provos%citi.umich.edu@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_systrace.c,v 1.39 2004/04/25 16:42:41 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_systrace.c,v 1.40 2004/05/26 16:28:05 christos Exp $");
 
 #include "opt_systrace.h"
 
@@ -1191,7 +1191,7 @@
        iov.iov_len = io->strio_len;
        uio.uio_iov = &iov;
        uio.uio_iovcnt = 1;
-       uio.uio_offset = (off_t)(long)io->strio_offs;
+       uio.uio_offset = (off_t)(unsigned long)io->strio_offs;
        uio.uio_resid = io->strio_len;
        uio.uio_segflg = UIO_USERSPACE;
        uio.uio_procp = p;
diff -r 962c3f57481b -r 9f468d33b403 sys/kern/sys_process.c
--- a/sys/kern/sys_process.c    Wed May 26 15:03:19 2004 +0000
+++ b/sys/kern/sys_process.c    Wed May 26 16:28:05 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_process.c,v 1.89 2004/05/14 16:36:33 christos Exp $        */
+/*     $NetBSD: sys_process.c,v 1.90 2004/05/26 16:28:05 christos Exp $        */
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -89,7 +89,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_process.c,v 1.89 2004/05/14 16:36:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_process.c,v 1.90 2004/05/26 16:28:05 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -310,7 +310,7 @@
                iov.iov_len = sizeof(tmp);
                uio.uio_iov = &iov;
                uio.uio_iovcnt = 1;
-               uio.uio_offset = (off_t)(long)SCARG(uap, addr);
+               uio.uio_offset = (off_t)(unsigned long)SCARG(uap, addr);
                uio.uio_resid = sizeof(tmp);
                uio.uio_segflg = UIO_SYSSPACE;
                uio.uio_rw = write ? UIO_WRITE : UIO_READ;
@@ -328,7 +328,7 @@
                iov.iov_len = piod.piod_len;
                uio.uio_iov = &iov;
                uio.uio_iovcnt = 1;
-               uio.uio_offset = (off_t)(long)piod.piod_offs;
+               uio.uio_offset = (off_t)(unsigned long)piod.piod_offs;
                uio.uio_resid = piod.piod_len;
                uio.uio_segflg = UIO_USERSPACE;
                uio.uio_procp = p;



Home | Main Index | Thread Index | Old Index