From: Konrad Rzeszutek Wilk Date: Tue, 15 Nov 2011 16:10:42 +0000 (-0500) Subject: Merge branches 'stable/mmu.fixes.rebased' and 'stable/bug.fixes-3.2.rebased' into... X-Git-Tag: v2.6.39-400.9.0~849^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=88a09b5dcdc22c6ed320c57e9b62f59013489353;p=users%2Fjedix%2Flinux-maple.git Merge branches 'stable/mmu.fixes.rebased' and 'stable/bug.fixes-3.2.rebased' into uek2-merge * stable/mmu.fixes.rebased: xen-gntalloc: signedness bug in add_grefs() xen-gntalloc: integer overflow in gntalloc_ioctl_alloc() xen-gntdev: integer overflow in gntdev_alloc_map() xen:pvhvm: enable PVHVM VCPU placement when using more than 32 CPUs. xen/balloon: Avoid OOM when requesting highmem * stable/bug.fixes-3.2.rebased: xen: Remove hanging references to CONFIG_XEN_PLATFORM_PCI --- 88a09b5dcdc22c6ed320c57e9b62f59013489353 diff --cc drivers/xen/balloon.c index d01944e871ca,7345c1da64ae,f54290baa3db..1a23033a1ac5 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@@@ -500,17 -374,17 -374,16 +500,17 @@@@ EXPORT_SYMBOL_GPL(balloon_set_new_targe * alloc_xenballooned_pages - get pages that have been ballooned out * @nr_pages: Number of pages to get * @pages: pages returned - * @highmem: highmem or lowmem pages + + * @highmem: allow highmem pages * @return 0 on success, error otherwise */ -int alloc_xenballooned_pages(int nr_pages, struct page** pages) +int alloc_xenballooned_pages(int nr_pages, struct page **pages, bool highmem) { int pgno = 0; -- struct page* page; ++ struct page *page; mutex_lock(&balloon_mutex); while (pgno < nr_pages) { - page = balloon_retrieve(true); - if (page) { + page = balloon_retrieve(highmem); - if (page && PageHighMem(page) == highmem) { + + if (page && (highmem || !PageHighMem(page))) { pages[pgno++] = page; } else { enum bp_state st; diff --cc drivers/xen/gntdev.c index 39871326afa2,2f3c3633dfa3,f914b26cf0c2..afca14d9042e --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@@@ -114,11 -114,11 -113,10 +114,11 @@@@ static struct grant_map *gntdev_alloc_m if (NULL == add) return NULL; - - add->grants = kzalloc(sizeof(add->grants[0]) * count, GFP_KERNEL); - - add->map_ops = kzalloc(sizeof(add->map_ops[0]) * count, GFP_KERNEL); - - add->unmap_ops = kzalloc(sizeof(add->unmap_ops[0]) * count, GFP_KERNEL); - add->kmap_ops = kzalloc(sizeof(add->kmap_ops[0]) * count, GFP_KERNEL); - - add->pages = kzalloc(sizeof(add->pages[0]) * count, GFP_KERNEL); + + add->grants = kcalloc(count, sizeof(add->grants[0]), GFP_KERNEL); + + add->map_ops = kcalloc(count, sizeof(add->map_ops[0]), GFP_KERNEL); + + add->unmap_ops = kcalloc(count, sizeof(add->unmap_ops[0]), GFP_KERNEL); + + add->kmap_ops = kcalloc(count, sizeof(add->kmap_ops[0]), GFP_KERNEL); + + add->pages = kcalloc(count, sizeof(add->pages[0]), GFP_KERNEL); if (NULL == add->grants || NULL == add->map_ops || NULL == add->unmap_ops ||