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.
This commit is contained in:
parent
c294d9d812
commit
67667b9ced
2 changed files with 11 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
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.
|
||||
|
|
10
kern/disk.c
10
kern/disk.c
|
@ -464,12 +464,14 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue