]> git.proxmox.com Git - grub2.git/commitdiff
2008-04-13 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Sun, 13 Apr 2008 18:40:25 +0000 (18:40 +0000)
committerrobertmh <robertmh@localhost>
Sun, 13 Apr 2008 18:40:25 +0000 (18:40 +0000)
        * disk/i386/pc/biosdisk.c (grub_biosdisk_rw): Fix CHS limit check,
        as per http://www.allensmith.net/Storage/HDDlimit/Int13h.htm

ChangeLog
disk/i386/pc/biosdisk.c

index 8ab8ba7679ee18e4c4851e37758ef1ea416d95e3..79c1db86be8364fd3ea94ed05b92a8f0b3ad9dce 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-13  Robert Millan  <rmh@aybabtu.com>
+
+       * disk/i386/pc/biosdisk.c (grub_biosdisk_rw): Fix CHS limit check,
+       as per http://www.allensmith.net/Storage/HDDlimit/Int13h.htm
+
 2008-04-13  Christian Franke  <franke@computer.org>
 
        * util/i386/pc/grub-mkrescue.in: Add --emulation=floppy
index 93f0da91f2becbd7e2779e7ecd2565d9d72281f5..094bde0aa517b2188f8c811f0442f026eef29170 100644 (file)
@@ -234,15 +234,17 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
     {
       unsigned coff, hoff, soff;
       unsigned head;
-      unsigned real_sector = (unsigned) sector;
       
-      /* It is impossible to reach over 2TB with the traditional
-        CHS access.  */
-      if (sector > ~0UL)
+      /* It is impossible to reach over 8064 MiB (a bit less than LBA24) with
+        the traditional CHS access.  */
+      if (sector >
+         1024 /* cylinders */ *
+         256 /* heads */ *
+         63 /* spt */)
        return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk");
 
-      soff = real_sector % data->sectors + 1;
-      head = real_sector / data->sectors;
+      soff = ((grub_uint32_t) sector) % data->sectors + 1;
+      head = ((grub_uint32_t) sector) / data->sectors;
       hoff = head % data->heads;
       coff = head / data->heads;