|
|
a5bd9f6 |
From 14cd2eb249c43b97193fc8456e0ffa073537bdbd Mon Sep 17 00:00:00 2001
|
|
|
a5bd9f6 |
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
a5bd9f6 |
Date: Thu, 4 Apr 2013 08:55:06 +0200
|
|
|
a5bd9f6 |
Subject: [PATCH 250/364] * util/grub-setup.c (setup): Handle some
|
|
|
a5bd9f6 |
corner cases.
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
---
|
|
|
a5bd9f6 |
ChangeLog | 4 ++++
|
|
|
a5bd9f6 |
util/grub-setup.c | 8 ++++++--
|
|
|
a5bd9f6 |
2 files changed, 10 insertions(+), 2 deletions(-)
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
diff --git a/ChangeLog b/ChangeLog
|
|
|
a5bd9f6 |
index 467a621..8a3fd45 100644
|
|
|
a5bd9f6 |
--- a/ChangeLog
|
|
|
a5bd9f6 |
+++ b/ChangeLog
|
|
|
a5bd9f6 |
@@ -1,5 +1,9 @@
|
|
|
a5bd9f6 |
2013-04-04 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
+ * util/grub-setup.c (setup): Handle some corner cases.
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
+2013-04-04 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
* grub-core/lib/posix_wrap/locale.h [GRUB_UTIL]: Include host locale.h.
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
2013-04-03 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a5bd9f6 |
diff --git a/util/grub-setup.c b/util/grub-setup.c
|
|
|
a5bd9f6 |
index 5a7a857..27a815f 100644
|
|
|
a5bd9f6 |
--- a/util/grub-setup.c
|
|
|
a5bd9f6 |
+++ b/util/grub-setup.c
|
|
|
a5bd9f6 |
@@ -256,7 +256,7 @@ setup (const char *dir,
|
|
|
a5bd9f6 |
grub_device_t root_dev = 0, dest_dev, core_dev;
|
|
|
a5bd9f6 |
struct blocklists bl;
|
|
|
a5bd9f6 |
char *tmp_img;
|
|
|
a5bd9f6 |
- grub_disk_addr_t first_sector;
|
|
|
a5bd9f6 |
+ grub_disk_addr_t first_sector = (grub_disk_addr_t)-1;
|
|
|
a5bd9f6 |
FILE *fp;
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
#ifdef GRUB_SETUP_BIOS
|
|
|
a5bd9f6 |
@@ -756,6 +756,8 @@ unable_to_embed:
|
|
|
a5bd9f6 |
grub_util_error ("%s", _("blocksize is not divisible by 512"));
|
|
|
a5bd9f6 |
mul = bsize >> GRUB_DISK_SECTOR_BITS;
|
|
|
a5bd9f6 |
nblocks = (core_size + bsize - 1) / bsize;
|
|
|
a5bd9f6 |
+ if (mul == 0 || nblocks == 0)
|
|
|
a5bd9f6 |
+ grub_util_error ("%s", _("can't retrieve blocklists"));
|
|
|
a5bd9f6 |
for (i = 0; i < nblocks; i++)
|
|
|
a5bd9f6 |
{
|
|
|
a5bd9f6 |
unsigned blk = i;
|
|
|
a5bd9f6 |
@@ -808,7 +810,7 @@ unable_to_embed:
|
|
|
a5bd9f6 |
- j * GRUB_DISK_SECTOR_SIZE);
|
|
|
a5bd9f6 |
if (len > GRUB_DISK_SECTOR_SIZE)
|
|
|
a5bd9f6 |
len = GRUB_DISK_SECTOR_SIZE;
|
|
|
a5bd9f6 |
- if (i == 0 && j == 0)
|
|
|
a5bd9f6 |
+ if (first_sector == (grub_disk_addr_t)-1)
|
|
|
a5bd9f6 |
save_first_sector ((fie2->fm_extents[i].fe_physical
|
|
|
a5bd9f6 |
>> GRUB_DISK_SECTOR_BITS)
|
|
|
a5bd9f6 |
+ j + container_start,
|
|
|
a5bd9f6 |
@@ -825,6 +827,8 @@ unable_to_embed:
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
+ if (first_sector == (grub_disk_addr_t)-1)
|
|
|
a5bd9f6 |
+ grub_util_error ("%s", _("can't retrieve blocklists"));
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
fclose (fp);
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
--
|
|
|
a5bd9f6 |
1.8.1.4
|
|
|
a5bd9f6 |
|