[SeaBIOS] [PATCH] disk: fail LBA I/O with zero sector count

Kevin O'Connor kevin at koconnor.net
Sat Feb 11 15:38:21 CET 2012


On Fri, Feb 10, 2012 at 02:46:30PM +0100, Paolo Bonzini wrote:
> Unlike basic_access, extended_access does not check for a zero
> sector count.  However, this is a problem because for example
> it would be interpreted as 256 when processing an ATA request.

Thanks.  The EDD spec seems to imply that sending a zero isn't an
error.  How about the below instead?

-Kevin


--- a/src/disk.c
+++ b/src/disk.c
@@ -135,6 +135,11 @@ extended_access(struct bregs *regs, struct drive_s *drive_g, u16 command)
 
     dop.buf_fl = SEGOFF_TO_FLATPTR(GET_INT13EXT(regs, data));
     dop.count = GET_INT13EXT(regs, count);
+    if (! dop.count) {
+        // Nothing to do.
+        disk_ret(regs, DISK_RET_SUCCESS);
+        return;
+    }
 
     int status = send_disk_op(&dop);
 



More information about the SeaBIOS mailing list