2010-02-03 Vladimir Serbinenko <phcoder@gmail.com>
* disk/i386/pc/biosdisk.c (grub_biosdisk_read): Handle non-2048 aligned CDROM reads. (grub_biosdisk_write): Refuse to write to CDROM.
This commit is contained in:
parent
3b205d4ddf
commit
996649b073
2 changed files with 19 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2010-02-03 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* disk/i386/pc/biosdisk.c (grub_biosdisk_read): Handle non-2048 aligned
|
||||
CDROM reads.
|
||||
(grub_biosdisk_write): Refuse to write to CDROM.
|
||||
|
||||
2010-01-31 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Fix off-by-one error.
|
||||
|
|
|
@ -307,8 +307,17 @@ grub_biosdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
while (size)
|
||||
{
|
||||
grub_size_t len;
|
||||
grub_size_t cdoff = 0;
|
||||
|
||||
len = get_safe_sectors (sector, data->sectors);
|
||||
|
||||
if (data->flags & GRUB_BIOSDISK_FLAG_CDROM)
|
||||
{
|
||||
cdoff = (sector & 3) << GRUB_DISK_SECTOR_BITS;
|
||||
len = ALIGN_UP (sector + len, 4) - (sector & ~3);
|
||||
sector &= ~3;
|
||||
}
|
||||
|
||||
if (len > size)
|
||||
len = size;
|
||||
|
||||
|
@ -316,7 +325,7 @@ grub_biosdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
GRUB_MEMORY_MACHINE_SCRATCH_SEG))
|
||||
return grub_errno;
|
||||
|
||||
grub_memcpy (buf, (void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR,
|
||||
grub_memcpy (buf, (void *) (GRUB_MEMORY_MACHINE_SCRATCH_ADDR + cdoff),
|
||||
len << GRUB_DISK_SECTOR_BITS);
|
||||
buf += len << GRUB_DISK_SECTOR_BITS;
|
||||
sector += len;
|
||||
|
@ -332,6 +341,9 @@ grub_biosdisk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
{
|
||||
struct grub_biosdisk_data *data = disk->data;
|
||||
|
||||
if (data->flags & GRUB_BIOSDISK_FLAG_CDROM)
|
||||
return grub_error (GRUB_ERR_IO, "can't write to CDROM");
|
||||
|
||||
while (size)
|
||||
{
|
||||
grub_size_t len;
|
||||
|
|
Loading…
Reference in a new issue