From 86981e426d07f7595a01f6917c2e3befcb19c079 Mon Sep 17 00:00:00 2001 From: Allan Jude Date: Sat, 16 Jun 2018 02:50:29 +0000 Subject: [PATCH] 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 --- stand/i386/libi386/biosdisk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stand/i386/libi386/biosdisk.c b/stand/i386/libi386/biosdisk.c index ead5dbd0cfc..194e28327db 100644 --- a/stand/i386/libi386/biosdisk.c +++ b/stand/i386/libi386/biosdisk.c @@ -594,8 +594,8 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, *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. */