]> git.proxmox.com Git - grub2.git/commitdiff
* grub-core/kern/disk.c (grub_disk_read): Fix hook calling for
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 24 Dec 2011 01:43:21 +0000 (02:43 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 24 Dec 2011 01:43:21 +0000 (02:43 +0100)
unaligned segments.

ChangeLog
grub-core/kern/disk.c

index 8c4a5b4689ceab24a4755a54774cbc773c07cf91..18f6778c5ecd59a3586936ae34bf6f1066bbd549 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-24  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/kern/disk.c (grub_disk_read): Fix hook calling for
+       unaligned segments.
+
 2011-12-24  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Add ieee1275/
index 460d8778f39916d90a74287c83c34bc89ef7f233..fb9782ff9dd59229c1d5ba07eaa42822ca3b8481 100644 (file)
@@ -607,12 +607,13 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
 
       while (l)
        {
-         (disk->read_hook) (s, o,
-                            ((l > GRUB_DISK_SECTOR_SIZE)
-                             ? GRUB_DISK_SECTOR_SIZE
-                             : l));
+         grub_size_t cl;
+         cl = GRUB_DISK_SECTOR_SIZE - o;
+         if (cl > l)
+           cl = l;
+         (disk->read_hook) (s, o, cl);
          s++;
-         l -= GRUB_DISK_SECTOR_SIZE - o;
+         l -= cl;
          o = 0;
        }
     }