2010-01-20 Dan Merillat <debian@dan.merillat.org>

* kern/device.c (grub_device_iterate): Allocate new part_ent
	structure based on sizeof (*p) rather than sizeof (p->next), to
	account for structure padding.

	* util/grub-probe.c (probe_raid_level): Return -1 immediately if
	disk is NULL, which might happen for LVM physical volumes with no
	LVM signature.
This commit is contained in:
Colin Watson 2010-01-20 02:11:07 +00:00
parent d4a4ee5765
commit 917dd37040
3 changed files with 16 additions and 1 deletions

View file

@ -1,3 +1,13 @@
2010-01-20 Dan Merillat <debian@dan.merillat.org>
* kern/device.c (grub_device_iterate): Allocate new part_ent
structure based on sizeof (*p) rather than sizeof (p->next), to
account for structure padding.
* util/grub-probe.c (probe_raid_level): Return -1 immediately if
disk is NULL, which might happen for LVM physical volumes with no
LVM signature.
2009-12-20 Robert Millan <rmh.grub@aybabtu.com>
* loader/mips/linux.c (grub_cmd_initrd)

View file

@ -138,7 +138,7 @@ grub_device_iterate (int (*hook) (const char *name))
if (! partition_name)
return 1;
p = grub_malloc (sizeof (p->next) + grub_strlen (disk->name) + 1 +
p = grub_malloc (sizeof (*p) + grub_strlen (disk->name) + 1 +
grub_strlen (partition_name) + 1);
if (!p)
{

View file

@ -94,6 +94,11 @@ probe_partmap (grub_disk_t disk)
static int
probe_raid_level (grub_disk_t disk)
{
/* disk might be NULL in the case of a LVM physical volume with no LVM
signature. Ignore such cases here. */
if (!disk)
return -1;
if (disk->dev->id != GRUB_DISK_DEVICE_RAID_ID)
return -1;