svn commit: r314936 - head/sys/x86/isa
Eric van Gyzen
vangyzen at FreeBSD.org
Thu Mar 9 02:19:31 UTC 2017
Author: vangyzen
Date: Thu Mar 9 02:19:30 2017
New Revision: 314936
URL: https://svnweb.freebsd.org/changeset/base/314936
Log:
Validate values read from the RTC before trying BCD decoding
Submitted by: cem
Reported by: Michael Gmelin <freebsd at grem.de>
Tested by: Oleksandr Tymoshenko <gonzo at bluezbox.com>
Sponsored by: Dell EMC
Modified:
head/sys/x86/isa/atrtc.c
Modified: head/sys/x86/isa/atrtc.c
==============================================================================
--- head/sys/x86/isa/atrtc.c Thu Mar 9 01:26:10 2017 (r314935)
+++ head/sys/x86/isa/atrtc.c Thu Mar 9 02:19:30 2017 (r314936)
@@ -102,7 +102,12 @@ writertc(int reg, u_char val)
static __inline int
readrtc(int port)
{
- return(bcd2bin(rtcin(port)));
+ int readval;
+
+ readval = rtcin(port);
+ if (readval >= 0 && (readval & 0xf) < 0xa && (readval & 0xf0) < 0xa0)
+ return (bcd2bin(readval));
+ return (0);
}
static void
More information about the svn-src-head
mailing list