svn commit: r335245 - head/stand/i386/libi386

Allan Jude allanjude at FreeBSD.org
Sat Jun 16 02:50:30 UTC 2018


Author: allanjude
Date: Sat Jun 16 02:50:29 2018
New Revision: 335245
URL: https://svnweb.freebsd.org/changeset/base/335245

Log:
  Correct logic error in biosdisk.c:bd_realstrategy()
  
  The wrong condition is used when evaluating the return of disk_ioctl()
  This results in reaching the 'We should not get here' branch in most casts
  
  Reviewed by:	imp
  Sponsored by:	Klara Systems
  Differential Revision:	https://reviews.freebsd.org/D15839

Modified:
  head/stand/i386/libi386/biosdisk.c

Modified: head/stand/i386/libi386/biosdisk.c
==============================================================================
--- head/stand/i386/libi386/biosdisk.c	Sat Jun 16 00:35:19 2018	(r335244)
+++ head/stand/i386/libi386/biosdisk.c	Sat Jun 16 02:50:29 2018	(r335245)
@@ -594,8 +594,8 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
 	*rsize = 0;
 
     /* Get disk blocks, this value is either for whole disk or for partition */
-    if (disk_ioctl(dev, DIOCGMEDIASIZE, &disk_blocks)) {
-	/* DIOCGMEDIASIZE does return bytes. */
+    if (disk_ioctl(dev, DIOCGMEDIASIZE, &disk_blocks) == 0) {
+	/* DIOCGMEDIASIZE returns bytes. */
         disk_blocks /= BD(dev).bd_sectorsize;
     } else {
 	/* We should not get here. Just try to survive. */


More information about the svn-src-all mailing list