[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/5] x86/PoD: Avoid using variable length arrays in p2m_pod_zero_check()
Callers of p2m_pod_zero_check() pass a count of up to POD_SWEEP_STRIDE. Move the definition of POD_SWEEP_STRIDE and give the arrays a fixed bound. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Wei Liu <wei.liu2@xxxxxxxxxx> CC: George Dunlap <george.dunlap@xxxxxxxxxxxxx> --- xen/arch/x86/mm/p2m-pod.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c index f1b221f..7978456 100644 --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -862,15 +862,19 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn) return ret; } +#define POD_SWEEP_LIMIT 1024 +#define POD_SWEEP_STRIDE 16 + static void p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, unsigned int count) { - mfn_t mfns[count]; - p2m_type_t types[count]; - unsigned long *map[count]; + mfn_t mfns[POD_SWEEP_STRIDE]; + p2m_type_t types[POD_SWEEP_STRIDE]; + unsigned long *map[POD_SWEEP_STRIDE]; struct domain *d = p2m->domain; unsigned int i, j, max_ref = 1; + BUG_ON(count > POD_SWEEP_STRIDE); /* Allow an extra refcount for one shadow pt mapping in shadowed domains */ if ( paging_mode_shadow(d) ) @@ -1012,8 +1016,6 @@ p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, unsigned int count unmap_domain_page(map[i]); } -#define POD_SWEEP_LIMIT 1024 -#define POD_SWEEP_STRIDE 16 static void p2m_pod_emergency_sweep(struct p2m_domain *p2m) { -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |