[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] ARM/dom0: Avoid using a variable length array in make_memory_node()
commit cd8015b634b005a3911bd6025351cd854d63a82a Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Mon Sep 24 14:00:02 2018 +0100 Commit: Julien Grall <julien.grall@xxxxxxx> CommitDate: Mon Sep 24 14:43:47 2018 +0100 ARM/dom0: Avoid using a variable length array in make_memory_node() The reg[] array can have a maximum size of 8 in practice, so use the worst case calculation rather than making it variable length. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Julien Grall <julien.grall@xxxxxxx> --- xen/arch/arm/domain_build.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 38e0de3b03..ac8d4799f3 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -539,9 +539,11 @@ static int __init make_memory_node(const struct domain *d, int res, i; int reg_size = addrcells + sizecells; int nr_cells = reg_size*kinfo->mem.nr_banks; - __be32 reg[nr_cells]; + __be32 reg[NR_MEM_BANKS * 4 /* Worst case addrcells + sizecells */]; __be32 *cells; + BUG_ON(nr_cells >= ARRAY_SIZE(reg)); + dt_dprintk("Create memory node (reg size %d, nr cells %d)\n", reg_size, nr_cells); -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |