From owner-svn-src-head@freebsd.org Sat Aug 4 14:13:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F1F5106C978; Sat, 4 Aug 2018 14:13:10 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C816779046; Sat, 4 Aug 2018 14:13:09 +0000 (UTC) (envelope-from delphij@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A90B810954; Sat, 4 Aug 2018 14:13:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w74ED9i3015021; Sat, 4 Aug 2018 14:13:09 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w74ED9Yd015020; Sat, 4 Aug 2018 14:13:09 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201808041413.w74ED9Yd015020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 4 Aug 2018 14:13:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r337317 - head/stand/i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/stand/i386/libi386 X-SVN-Commit-Revision: 337317 X-SVN-Commit-Repository: base 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.27 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: Sat, 04 Aug 2018 14:13:10 -0000 Author: delphij Date: Sat Aug 4 14:13:09 2018 New Revision: 337317 URL: https://svnweb.freebsd.org/changeset/base/337317 Log: In r337271, we limited the sector number to the lower of calculated number and CHS based number. However, on some systems, BIOS would report 0 in CHS fields, making the system to think there is 0 sectors. Add a check before comparing the calculated total with bd_sectors. Reviewed by: tsoome, cy Differential Revision: https://reviews.freebsd.org/D16577 Modified: head/stand/i386/libi386/biosdisk.c Modified: head/stand/i386/libi386/biosdisk.c ============================================================================== --- head/stand/i386/libi386/biosdisk.c Sat Aug 4 13:57:50 2018 (r337316) +++ head/stand/i386/libi386/biosdisk.c Sat Aug 4 14:13:09 2018 (r337317) @@ -275,7 +275,7 @@ bd_int13probe(struct bdinfo *bd) total = (uint64_t)params.cylinders * params.heads * params.sectors_per_track; - if (bd->bd_sectors > total) + if (total > 0 && bd->bd_sectors > total) bd->bd_sectors = total; ret = 1;