2010-01-04 Robert Millan <rmh.grub@aybabtu.com>
* disk/i386/pc/biosdisk.c (grub_biosdisk_rw): Use ALIGN_UP macro instead of manual alignment. * kern/disk.c (grub_disk_read): Remove grub_dprintf call (excessively verbose). Avoid attempts to read past end of the device (grub_disk_adjust_range() guarantees that we can read `size' bytes, but GRUB_DISK_CACHE_SIZE may exceed that).
This commit is contained in:
parent
4b856776a9
commit
e33ace066e
3 changed files with 15 additions and 7 deletions
|
@ -1,3 +1,12 @@
|
|||
2010-01-04 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* disk/i386/pc/biosdisk.c (grub_biosdisk_rw): Use ALIGN_UP macro
|
||||
instead of manual alignment.
|
||||
* kern/disk.c (grub_disk_read): Remove grub_dprintf call (excessively
|
||||
verbose). Avoid attempts to read past end of the device
|
||||
(grub_disk_adjust_range() guarantees that we can read `size' bytes,
|
||||
but GRUB_DISK_CACHE_SIZE may exceed that).
|
||||
|
||||
2010-01-04 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* commands/crc.c (grub_cmd_crc): Abort on read errors.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -222,7 +222,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
|
|||
if (cmd)
|
||||
return grub_error (GRUB_ERR_WRITE_ERROR, "can\'t write to cdrom");
|
||||
|
||||
dap->blocks = (dap->blocks + 3) >> 2;
|
||||
dap->blocks = ALIGN_UP (dap->blocks, 4) >> 2;
|
||||
dap->block >>= 2;
|
||||
|
||||
for (i = 0; i < GRUB_BIOSDISK_CDROM_RETRY_COUNT; i++)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,2004,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -386,8 +386,6 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
char *tmp_buf;
|
||||
unsigned real_offset;
|
||||
|
||||
grub_dprintf ("disk", "Reading `%s'...\n", disk->name);
|
||||
|
||||
/* First of all, check if the region is within the disk. */
|
||||
if (grub_disk_adjust_range (disk, §or, &offset, size) != GRUB_ERR_NONE)
|
||||
{
|
||||
|
@ -432,7 +430,8 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
else
|
||||
{
|
||||
/* Otherwise read data from the disk actually. */
|
||||
if ((disk->dev->read) (disk, start_sector,
|
||||
if (start_sector + GRUB_DISK_CACHE_SIZE > disk->total_sectors
|
||||
|| (disk->dev->read) (disk, start_sector,
|
||||
GRUB_DISK_CACHE_SIZE, tmp_buf)
|
||||
!= GRUB_ERR_NONE)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue