+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.
/*
* 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
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++)
/*
* 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
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)
{
else
{
/* Otherwise read data from the disk actually. */
- if ((disk->dev->read) (disk, start_sector,
- GRUB_DISK_CACHE_SIZE, tmp_buf)
+ 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)
{
/* Uggh... Failed. Instead, just read necessary data. */