2010-01-21 Vladimir Serbinenko <phcoder@gmail.com>

* term/ieee1275/ofconsole.c (grub_ofconsole_dimensions): Allocate on
	stack since heap is unavailable at that point.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-01-22 00:07:28 +01:00
parent f9ab2e25d3
commit d645e0f8e8
2 changed files with 17 additions and 21 deletions

View file

@ -1,3 +1,8 @@
2010-01-21 Vladimir Serbinenko <phcoder@gmail.com>
* term/ieee1275/ofconsole.c (grub_ofconsole_dimensions): Allocate on
stack since heap is unavailable at that point.
2010-01-21 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/i386/bsd.h (FREEBSD_N_BIOS_GEOM): Removed.

View file

@ -245,37 +245,28 @@ static void
grub_ofconsole_dimensions (void)
{
grub_ieee1275_ihandle_t options;
char *val;
grub_ssize_t lval;
if (! grub_ieee1275_finddevice ("/options", &options)
&& options != (grub_ieee1275_ihandle_t) -1)
{
if (! grub_ieee1275_get_property_length (options, "screen-#columns",
&lval) && lval != -1)
{
val = grub_malloc (lval);
if (val)
&lval)
&& lval >= 0 && lval < 1024)
{
char val[lval];
if (! grub_ieee1275_get_property (options, "screen-#columns",
val, lval, 0))
grub_ofconsole_width = (grub_uint8_t) grub_strtoul (val, 0, 10);
grub_free (val);
}
}
if (! grub_ieee1275_get_property_length (options, "screen-#rows",
&lval) && lval != -1)
{
val = grub_malloc (lval);
if (val)
if (! grub_ieee1275_get_property_length (options, "screen-#rows", &lval)
&& lval >= 0 && lval < 1024)
{
char val[lval];
if (! grub_ieee1275_get_property (options, "screen-#rows",
val, lval, 0))
grub_ofconsole_height = (grub_uint8_t) grub_strtoul (val, 0, 10);
grub_free (val);
}
}
}