All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-4.6] x86/gdt: Drop write-only, xalloc()'d array from set_gdt()
@ 2015-08-03 17:05 Andrew Cooper
  2015-08-04  9:34 ` Wei Liu
  2015-08-04 14:17 ` George Dunlap
  0 siblings, 2 replies; 9+ messages in thread
From: Andrew Cooper @ 2015-08-03 17:05 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Wei Liu, Jan Beulich

It is not used, and can cause a spurious failure of the set_gdt() hypercall in
low memory situations.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
---
 xen/arch/x86/mm.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 63aa666..4b76587 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4439,20 +4439,15 @@ long set_gdt(struct vcpu *v,
     l1_pgentry_t *pl1e;
     /* NB. There are 512 8-byte entries per GDT page. */
     int i, nr_pages = (entries + 511) / 512;
-    unsigned long *pfns;
 
     if ( entries > FIRST_RESERVED_GDT_ENTRY )
         return -EINVAL;
 
-    pfns = xmalloc_array(unsigned long, nr_pages);
-    if ( !pfns )
-        return -ENOMEM;
-
     /* Check the pages in the new GDT. */
     for ( i = 0; i < nr_pages; i++ )
     {
         struct page_info *page;
-        pfns[i] = frames[i];
+
         page = get_page_from_gfn(d, frames[i], NULL, P2M_ALLOC);
         if ( !page )
             goto fail;
@@ -4476,7 +4471,6 @@ long set_gdt(struct vcpu *v,
         l1e_write(&pl1e[i], l1e_from_pfn(frames[i], __PAGE_HYPERVISOR_RW));
     }
 
-    xfree(pfns);
     return 0;
 
  fail:
@@ -4484,7 +4478,6 @@ long set_gdt(struct vcpu *v,
     {
         put_page_and_type(mfn_to_page(frames[i]));
     }
-    xfree(pfns);
     return -EINVAL;
 }
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-08-11 15:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-03 17:05 [PATCH for-4.6] x86/gdt: Drop write-only, xalloc()'d array from set_gdt() Andrew Cooper
2015-08-04  9:34 ` Wei Liu
2015-08-04 13:59   ` Ian Campbell
2015-08-04 14:05     ` Andrew Cooper
2015-08-05 10:57     ` Tim Deegan
2015-08-11 15:53     ` Jan Beulich
2015-08-04 14:17 ` George Dunlap
2015-08-05  9:58   ` Ian Campbell
2015-08-11 15:56     ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.