From owner-svn-src-head@freebsd.org Thu Mar 9 02:19:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DEB7D03A03; Thu, 9 Mar 2017 02:19:31 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D497173F; Thu, 9 Mar 2017 02:19:31 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v292JULh085430; Thu, 9 Mar 2017 02:19:30 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v292JUDS085429; Thu, 9 Mar 2017 02:19:30 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201703090219.v292JUDS085429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Thu, 9 Mar 2017 02:19:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314936 - head/sys/x86/isa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Mar 2017 02:19:31 -0000 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 Tested by: Oleksandr Tymoshenko 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