Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern in sbsavetimestamp(), initialize struct timeval to ...
details: https://anonhg.NetBSD.org/src/rev/6c75e9a7d6b8
branches: trunk
changeset: 1022730:6c75e9a7d6b8
user: chs <chs%NetBSD.org@localhost>
date: Tue Aug 03 20:27:08 2021 +0000
description:
in sbsavetimestamp(), initialize struct timeval to 0 with memset() so that
the implicit padding is initialized. this avoids later copying uninitialized
memory out to user space. detected by KMSAN.
diffstat:
sys/kern/uipc_socket.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diffs (26 lines):
diff -r 33eddad22bde -r 6c75e9a7d6b8 sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c Tue Aug 03 20:25:43 2021 +0000
+++ b/sys/kern/uipc_socket.c Tue Aug 03 20:27:08 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_socket.c,v 1.294 2020/12/11 03:00:09 thorpej Exp $ */
+/* $NetBSD: uipc_socket.c,v 1.295 2021/08/03 20:27:08 chs Exp $ */
/*
* Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.294 2020/12/11 03:00:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.295 2021/08/03 20:27:08 chs Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -2432,6 +2432,7 @@
struct timeval tv;
int error;
+ memset(&tv, 0, sizeof(tv));
microtime(&tv);
MODULE_HOOK_CALL(uipc_socket_50_sbts_hook, (opt, &mp), enosys(), error);
Home |
Main Index |
Thread Index |
Old Index