mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-21 14:59:34 +00:00
fix potential bugs in some LBA code
This commit is contained in:
1 parent
0f4f88a9d9
commit
7e9a0794d0
7 files changed
+46
-9
No files matched your search
+5
-4
@@ -159,10 +159,11 @@ get_diskinfo (int drive, struct geometry *geometry)
|
||||
if (! err)
|
||||
{
|
||||
geometry->flags = BIOSDISK_FLAG_LBA_EXTENSION;
|
||||
|
||||
/* Check if CHS information is valid. */
|
||||
if (drp.flags & 0x02)
|
||||
total_sectors = drp.cylinders * drp.heads * drp.sectors;
|
||||
|
||||
/* FIXME: when the 2TB limit becomes critical, we must
|
||||
change the type of TOTAL_SECTORS to unsigned long
|
||||
long. */
|
||||
total_sectors = drp.total_sectors & ~0L;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -675,11 +675,15 @@ returnit:
|
||||
else
|
||||
{
|
||||
char *msg;
|
||||
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
msg = device_map[current_drive];
|
||||
#else
|
||||
if (geom.flags & BIOSDISK_FLAG_LBA_EXTENSION)
|
||||
msg = "LBA";
|
||||
else
|
||||
msg = "CHS";
|
||||
#endif
|
||||
|
||||
grub_printf ("drive 0x%x: C/H/S = %d/%d/%d, "
|
||||
"The number of sectors = %d, %s\n",
|
||||
|
||||
@@ -312,6 +312,8 @@ extern int use_curses;
|
||||
extern int verbose;
|
||||
/* The flag for read-only. */
|
||||
extern int read_only;
|
||||
/* The map between BIOS drives and UNIX device file names. */
|
||||
extern char **device_map;
|
||||
#endif
|
||||
|
||||
#ifndef STAGE1_5
|
||||
|
||||
Reference in new issue
Block a user