* grub-core/kern/i386/qemu/init.c: Remove variable length arrays.
This commit is contained in:
parent
85eb579ad9
commit
bb6e299ccb
2 changed files with 10 additions and 15 deletions
|
@ -1,3 +1,7 @@
|
|||
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/i386/qemu/init.c: Remove variable length arrays.
|
||||
|
||||
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* include/grub/types.h: Declare all byteswaps as inline functions
|
||||
|
|
|
@ -96,17 +96,8 @@ struct iterator_ctx
|
|||
grub_size_t nresources;
|
||||
};
|
||||
|
||||
static int
|
||||
count_cards (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
grub_pci_id_t pciid __attribute__ ((unused)),
|
||||
void *data)
|
||||
{
|
||||
int *cnt = data;
|
||||
|
||||
(*cnt)++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* We don't support bridges, so can't have more than 32 devices. */
|
||||
#define MAX_DEVICES 32
|
||||
|
||||
static int
|
||||
find_resources (grub_pci_device_t dev,
|
||||
|
@ -116,6 +107,9 @@ find_resources (grub_pci_device_t dev,
|
|||
struct iterator_ctx *ctx = data;
|
||||
int bar;
|
||||
|
||||
if (ctx->nresources >= MAX_DEVICES * 6)
|
||||
return 1;
|
||||
|
||||
for (bar = 0; bar < 6; bar++)
|
||||
{
|
||||
grub_pci_address_t addr;
|
||||
|
@ -190,13 +184,10 @@ enable_cards (grub_pci_device_t dev,
|
|||
static void
|
||||
grub_pci_assign_addresses (void)
|
||||
{
|
||||
int ncards = 0;
|
||||
struct iterator_ctx ctx;
|
||||
|
||||
grub_pci_iterate (count_cards, &ncards);
|
||||
|
||||
{
|
||||
struct resource resources[ncards * 6];
|
||||
struct resource resources[MAX_DEVICES * 6];
|
||||
int done;
|
||||
unsigned i;
|
||||
ctx.nresources = 0;
|
||||
|
|
Loading…
Reference in a new issue