From: jsg Date: Sat, 13 Jun 2015 07:16:36 +0000 (+0000) Subject: When investigating an uninitialised variable in the armv7 resettodr() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=48f8499b6af82f7f4284f4a871dd1c795de53770;p=openbsd When investigating an uninitialised variable in the armv7 resettodr() miod pointed out that time_second should be compared to 1 not 0 in the md resettodr() functions as it is initialised to 1. ok miod@ deraadt@ --- diff --git a/sys/arch/arm/xscale/i80321_clock.c b/sys/arch/arm/xscale/i80321_clock.c index dc72db0e0e5..1df195b3423 100644 --- a/sys/arch/arm/xscale/i80321_clock.c +++ b/sys/arch/arm/xscale/i80321_clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i80321_clock.c,v 1.9 2010/09/20 06:33:47 matthew Exp $ */ +/* $OpenBSD: i80321_clock.c,v 1.10 2015/06/13 07:16:36 jsg Exp $ */ /* * Copyright (c) 2006 Dale Rahn @@ -490,7 +490,7 @@ resettodr(void) { struct timeval rtctime; - if (time_second == 0) + if (time_second == 1) return; microtime(&rtctime); diff --git a/sys/arch/armv7/armv7/intr.c b/sys/arch/armv7/armv7/intr.c index 62938a9d33a..b481375baaf 100644 --- a/sys/arch/armv7/armv7/intr.c +++ b/sys/arch/armv7/armv7/intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.c,v 1.2 2013/09/10 12:36:57 patrick Exp $ */ +/* $OpenBSD: intr.c,v 1.3 2015/06/13 07:16:37 jsg Exp $ */ /* * Copyright (c) 2011 Dale Rahn * @@ -419,7 +419,7 @@ resettodr(void) { struct timeval rtctime; - if (rtctime.tv_sec == 0) + if (time_second == 1) return; microtime(&rtctime); diff --git a/sys/arch/aviion/dev/nvram.c b/sys/arch/aviion/dev/nvram.c index ffc7b946426..cf0679c734f 100644 --- a/sys/arch/aviion/dev/nvram.c +++ b/sys/arch/aviion/dev/nvram.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvram.c,v 1.11 2015/02/10 22:42:35 miod Exp $ */ +/* $OpenBSD: nvram.c,v 1.12 2015/06/13 07:16:36 jsg Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -316,7 +316,7 @@ resettodr() struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[0]; struct chiptime c; - if (time_second == 0 || sc == NULL) + if (time_second == 1 || sc == NULL) return; timetochip(&c); diff --git a/sys/arch/macppc/macppc/clock.c b/sys/arch/macppc/macppc/clock.c index d46728c56e5..4e35f475380 100644 --- a/sys/arch/macppc/macppc/clock.c +++ b/sys/arch/macppc/macppc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.39 2014/11/11 21:02:06 mpi Exp $ */ +/* $OpenBSD: clock.c,v 1.40 2015/06/13 07:16:36 jsg Exp $ */ /* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */ /* @@ -162,7 +162,7 @@ resettodr(void) { struct timeval tv; - if (time_second == 0) + if (time_second == 1) return; microtime(&tv); diff --git a/sys/arch/socppc/socppc/clock.c b/sys/arch/socppc/socppc/clock.c index c1ebef574ef..58ddf4ff8a3 100644 --- a/sys/arch/socppc/socppc/clock.c +++ b/sys/arch/socppc/socppc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.12 2014/11/11 21:02:06 mpi Exp $ */ +/* $OpenBSD: clock.c,v 1.13 2015/06/13 07:16:37 jsg Exp $ */ /* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */ /* @@ -148,7 +148,7 @@ resettodr(void) { struct timeval tv; - if (time_second == 0) + if (time_second == 1) return; microtime(&tv); diff --git a/sys/arch/sparc64/sparc64/clock.c b/sys/arch/sparc64/sparc64/clock.c index 0bfe3360787..f15cd6f8ccb 100644 --- a/sys/arch/sparc64/sparc64/clock.c +++ b/sys/arch/sparc64/sparc64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.56 2014/12/17 19:39:01 tedu Exp $ */ +/* $OpenBSD: clock.c,v 1.57 2015/06/13 07:16:37 jsg Exp $ */ /* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */ /* @@ -968,7 +968,7 @@ resettodr() { struct timeval tv; - if (time_second == 0) + if (time_second == 1) return; microtime(&tv);