Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Fix uninitialized memory access. Found by KMSAN.



details:   https://anonhg.NetBSD.org/src/rev/5c740c824404
branches:  trunk
changeset: 932733:5c740c824404
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu May 14 18:18:24 2020 +0000

description:
Fix uninitialized memory access. Found by KMSAN.

Reported-by: syzbot+9f2a173d29d66c88f9ac%syzkaller.appspotmail.com@localhost

diffstat:

 sys/kern/kern_time.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 6d3a64db858e -r 5c740c824404 sys/kern/kern_time.c
--- a/sys/kern/kern_time.c      Thu May 14 18:06:58 2020 +0000
+++ b/sys/kern/kern_time.c      Thu May 14 18:18:24 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_time.c,v 1.203 2020/01/02 15:42:27 thorpej Exp $  */
+/*     $NetBSD: kern_time.c,v 1.204 2020/05/14 18:18:24 maxv Exp $     */
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.203 2020/01/02 15:42:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.204 2020/05/14 18:18:24 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/resourcevar.h>
@@ -352,8 +352,12 @@
                struct timespec rmtend;
                struct timespec t0;
                struct timespec *t;
+               int err;
 
-               (void)clock_gettime1(clock_id, &rmtend);
+               err = clock_gettime1(clock_id, &rmtend);
+               if (err != 0)
+                       return err;
+
                t = (rmt != NULL) ? rmt : &t0;
                if (flags & TIMER_ABSTIME) {
                        timespecsub(rqt, &rmtend, t);



Home | Main Index | Thread Index | Old Index