* kern/disk.c (grub_disk_read): Fix bug that would cause infinite
loop when using read hooks on files whose size isn't sector-aligned.
+2010-01-27 Robert Millan <rmh.grub@aybabtu.com>
+
+ * kern/disk.c (grub_disk_read): Fix bug that would cause infinite
+ loop when using read hooks on files whose size isn't sector-aligned.
+
2010-01-27 Robert Millan <rmh.grub@aybabtu.com>
Remove unused parameter.
if (disk->read_hook)
while (size)
{
+ grub_size_t to_read = (size > GRUB_DISK_SECTOR_SIZE) ? GRUB_DISK_SECTOR_SIZE : size;
(disk->read_hook) (sector, real_offset,
- ((size > GRUB_DISK_SECTOR_SIZE)
- ? GRUB_DISK_SECTOR_SIZE
- : size));
+ to_read);
+ if (grub_errno != GRUB_ERR_NONE)
+ goto finish;
+
sector++;
- size -= GRUB_DISK_SECTOR_SIZE - real_offset;
+ size -= to_read - real_offset;
real_offset = 0;
}