Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Fix bug: if seg == UIO_SYSSPACE, tv[] is not initia...



details:   https://anonhg.NetBSD.org/src/rev/849bb94c5af4
branches:  trunk
changeset: 457606:849bb94c5af4
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Jul 06 14:37:24 2019 +0000

description:
Fix bug: if seg == UIO_SYSSPACE, tv[] is not initialized. The branches
should depend on tptr[] instead.

diffstat:

 sys/kern/vfs_syscalls.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (47 lines):

diff -r 99fd54eefd6b -r 849bb94c5af4 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Sat Jul 06 14:27:38 2019 +0000
+++ b/sys/kern/vfs_syscalls.c   Sat Jul 06 14:37:24 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.532 2019/06/21 14:58:32 kamil Exp $ */
+/*     $NetBSD: vfs_syscalls.c,v 1.533 2019/07/06 14:37:24 maxv Exp $  */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.532 2019/06/21 14:58:32 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.533 2019/07/06 14:37:24 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -3913,21 +3913,21 @@
                struct timeval tv[2];
 
                if (seg != UIO_SYSSPACE) {
-                       error = copyin(tptr, tv, sizeof (tv));
+                       error = copyin(tptr, tv, sizeof(tv));
                        if (error != 0)
                                return error;
                        tptr = tv;
                }
 
-               if ((tv[0].tv_usec == UTIME_NOW) || 
-                   (tv[0].tv_usec == UTIME_OMIT))
-                       ts[0].tv_nsec = tv[0].tv_usec;
+               if ((tptr[0].tv_usec == UTIME_NOW) || 
+                   (tptr[0].tv_usec == UTIME_OMIT))
+                       ts[0].tv_nsec = tptr[0].tv_usec;
                else
                        TIMEVAL_TO_TIMESPEC(&tptr[0], &ts[0]);
 
-               if ((tv[1].tv_usec == UTIME_NOW) || 
-                   (tv[1].tv_usec == UTIME_OMIT))
-                       ts[1].tv_nsec = tv[1].tv_usec;
+               if ((tptr[1].tv_usec == UTIME_NOW) || 
+                   (tptr[1].tv_usec == UTIME_OMIT))
+                       ts[1].tv_nsec = tptr[1].tv_usec;
                else
                        TIMEVAL_TO_TIMESPEC(&tptr[1], &ts[1]);
 



Home | Main Index | Thread Index | Old Index