Fixed a cache collision bug. Thanks guufy1 for bugreport and test
This commit is contained in:
parent
77ba5392d0
commit
2df2e89fee
1 changed files with 12 additions and 6 deletions
|
@ -544,6 +544,17 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
break;
|
||||
}
|
||||
|
||||
if (data)
|
||||
{
|
||||
grub_memcpy ((char *) buf
|
||||
+ (agglomerate << (GRUB_DISK_CACHE_BITS
|
||||
+ GRUB_DISK_SECTOR_BITS)),
|
||||
data, GRUB_DISK_CACHE_SIZE << GRUB_DISK_SECTOR_BITS);
|
||||
grub_disk_cache_unlock (disk->dev->id, disk->id,
|
||||
sector + (agglomerate
|
||||
<< GRUB_DISK_CACHE_BITS));
|
||||
}
|
||||
|
||||
if (agglomerate)
|
||||
{
|
||||
grub_disk_addr_t i;
|
||||
|
@ -571,14 +582,9 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
|
||||
if (data)
|
||||
{
|
||||
grub_memcpy (buf, data,
|
||||
GRUB_DISK_CACHE_SIZE << GRUB_DISK_SECTOR_BITS);
|
||||
sector += GRUB_DISK_CACHE_SIZE;
|
||||
buf = (char *) buf + (GRUB_DISK_CACHE_SIZE << GRUB_DISK_SECTOR_BITS);
|
||||
size -= (GRUB_DISK_CACHE_SIZE << GRUB_DISK_SECTOR_BITS);
|
||||
grub_disk_cache_unlock (disk->dev->id, disk->id,
|
||||
sector + (agglomerate
|
||||
<< GRUB_DISK_CACHE_BITS));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue