* grub-core/kern/ieee1275/init.c (grub_machine_get_bootlocation): Use
dynamic allocation for the bootpath buffer.
This commit is contained in:
parent
74b2fe3e4f
commit
64ebd2f4b9
2 changed files with 22 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2012-12-10 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
|
||||||
|
|
||||||
|
* grub-core/kern/ieee1275/init.c (grub_machine_get_bootlocation): Use
|
||||||
|
dynamic allocation for the bootpath buffer.
|
||||||
|
|
||||||
2012-12-10 Dr. Tilmann Bubeck <t.bubeck@reinform.de>
|
2012-12-10 Dr. Tilmann Bubeck <t.bubeck@reinform.de>
|
||||||
|
|
||||||
* grub-core/gfxmenu/view.c (init_terminal): Avoid making terminal
|
* grub-core/gfxmenu/view.c (init_terminal): Avoid making terminal
|
||||||
|
|
|
@ -82,18 +82,30 @@ void (*grub_ieee1275_net_config) (const char *dev,
|
||||||
void
|
void
|
||||||
grub_machine_get_bootlocation (char **device, char **path)
|
grub_machine_get_bootlocation (char **device, char **path)
|
||||||
{
|
{
|
||||||
char bootpath[64]; /* XXX check length */
|
char *bootpath;
|
||||||
|
grub_ssize_t bootpath_size;
|
||||||
char *filename;
|
char *filename;
|
||||||
char *type;
|
char *type;
|
||||||
|
|
||||||
if (grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", &bootpath,
|
if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath",
|
||||||
sizeof (bootpath), 0))
|
&bootpath_size)
|
||||||
|
|| bootpath_size <= 0)
|
||||||
{
|
{
|
||||||
/* Should never happen. */
|
/* Should never happen. */
|
||||||
grub_printf ("/chosen/bootpath property missing!\n");
|
grub_printf ("/chosen/bootpath property missing!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64);
|
||||||
|
if (! bootpath)
|
||||||
|
{
|
||||||
|
grub_print_error ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath,
|
||||||
|
(grub_size_t) bootpath_size + 1, 0);
|
||||||
|
bootpath[bootpath_size] = '\0';
|
||||||
|
|
||||||
/* Transform an OF device path to a GRUB path. */
|
/* Transform an OF device path to a GRUB path. */
|
||||||
|
|
||||||
type = grub_ieee1275_get_device_type (bootpath);
|
type = grub_ieee1275_get_device_type (bootpath);
|
||||||
|
@ -132,6 +144,7 @@ grub_machine_get_bootlocation (char **device, char **path)
|
||||||
*path = filename;
|
*path = filename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
grub_free (bootpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Claim some available memory in the first /memory node. */
|
/* Claim some available memory in the first /memory node. */
|
||||||
|
|
Loading…
Reference in a new issue