aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-01-30 07:30:13 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:30:13 -0500
commit70f5088dd5e9fbd3a71b3a5b01395c676158194b (patch)
tree5d7f47f1db5c9a2da9c2a78e7fd87291e916b0bf /arch/x86/kernel
parentfc2d625c4fac18e672a3b7c61af5de22d7ab7d87 (diff)
x86: prepare arch/x86/kernel/ldt_32/64.c for merging
White space and coding style cleanups. Change unsigned to int. There is no win when we compare mincount against pc->size, which is an int as well. Casting pc->size to unsigned just might hide real problems. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/ldt_32.c3
-rw-r--r--arch/x86/kernel/ldt_64.c24
2 files changed, 12 insertions, 15 deletions
diff --git a/arch/x86/kernel/ldt_32.c b/arch/x86/kernel/ldt_32.c
index e366c5fd0d19..bb15753abaf2 100644
--- a/arch/x86/kernel/ldt_32.c
+++ b/arch/x86/kernel/ldt_32.c
@@ -27,8 +27,7 @@ static void flush_ldt(void *null)
27 27
28static int alloc_ldt(mm_context_t *pc, int mincount, int reload) 28static int alloc_ldt(mm_context_t *pc, int mincount, int reload)
29{ 29{
30 void *oldldt; 30 void *oldldt, *newldt;
31 void *newldt;
32 int oldsize; 31 int oldsize;
33 32
34 if (mincount <= pc->size) 33 if (mincount <= pc->size)
diff --git a/arch/x86/kernel/ldt_64.c b/arch/x86/kernel/ldt_64.c
index d72dc7a0636f..95903938e7ad 100644
--- a/arch/x86/kernel/ldt_64.c
+++ b/arch/x86/kernel/ldt_64.c
@@ -18,7 +18,7 @@
18#include <asm/system.h> 18#include <asm/system.h>
19#include <asm/ldt.h> 19#include <asm/ldt.h>
20#include <asm/desc.h> 20#include <asm/desc.h>
21#include <asm/proto.h> 21#include <asm/mmu_context.h>
22 22
23#ifdef CONFIG_SMP 23#ifdef CONFIG_SMP
24static void flush_ldt(void *null) 24static void flush_ldt(void *null)
@@ -28,13 +28,12 @@ static void flush_ldt(void *null)
28} 28}
29#endif 29#endif
30 30
31static int alloc_ldt(mm_context_t *pc, unsigned mincount, int reload) 31static int alloc_ldt(mm_context_t *pc, int mincount, int reload)
32{ 32{
33 void *oldldt; 33 void *oldldt, *newldt;
34 void *newldt; 34 int oldsize;
35 unsigned oldsize;
36 35
37 if (mincount <= (unsigned)pc->size) 36 if (mincount <= pc->size)
38 return 0; 37 return 0;
39 oldsize = pc->size; 38 oldsize = pc->size;
40 mincount = (mincount + 511) & (~511); 39 mincount = (mincount + 511) & (~511);
@@ -56,13 +55,14 @@ static int alloc_ldt(mm_context_t *pc, unsigned mincount, int reload)
56 wmb(); 55 wmb();
57 pc->size = mincount; 56 pc->size = mincount;
58 wmb(); 57 wmb();
58
59 if (reload) { 59 if (reload) {
60#ifdef CONFIG_SMP 60#ifdef CONFIG_SMP
61 cpumask_t mask; 61 cpumask_t mask;
62 62
63 preempt_disable(); 63 preempt_disable();
64 mask = cpumask_of_cpu(smp_processor_id());
65 load_LDT(pc); 64 load_LDT(pc);
65 mask = cpumask_of_cpu(smp_processor_id());
66 if (!cpus_equal(current->mm->cpu_vm_mask, mask)) 66 if (!cpus_equal(current->mm->cpu_vm_mask, mask))
67 smp_call_function(flush_ldt, NULL, 1, 1); 67 smp_call_function(flush_ldt, NULL, 1, 1);
68 preempt_enable(); 68 preempt_enable();
@@ -115,7 +115,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
115void destroy_context(struct mm_struct *mm) 115void destroy_context(struct mm_struct *mm)
116{ 116{
117 if (mm->context.size) { 117 if (mm->context.size) {
118 if ((unsigned)mm->context.size * LDT_ENTRY_SIZE > PAGE_SIZE) 118 if (mm->context.size * LDT_ENTRY_SIZE > PAGE_SIZE)
119 vfree(mm->context.ldt); 119 vfree(mm->context.ldt);
120 else 120 else
121 kfree(mm->context.ldt); 121 kfree(mm->context.ldt);
@@ -170,18 +170,16 @@ static int read_default_ldt(void __user *ptr, unsigned long bytecount)
170 170
171static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode) 171static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
172{ 172{
173 struct task_struct *me = current; 173 struct mm_struct *mm = current->mm;
174 struct mm_struct *mm = me->mm;
175 __u32 entry_1, entry_2; 174 __u32 entry_1, entry_2;
176 int error; 175 int error;
177 struct user_desc ldt_info; 176 struct user_desc ldt_info;
178 177
179 error = -EINVAL; 178 error = -EINVAL;
180
181 if (bytecount != sizeof(ldt_info)) 179 if (bytecount != sizeof(ldt_info))
182 goto out; 180 goto out;
183 error = -EFAULT; 181 error = -EFAULT;
184 if (copy_from_user(&ldt_info, ptr, bytecount)) 182 if (copy_from_user(&ldt_info, ptr, sizeof(ldt_info)))
185 goto out; 183 goto out;
186 184
187 error = -EINVAL; 185 error = -EINVAL;
@@ -195,7 +193,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
195 } 193 }
196 194
197 mutex_lock(&mm->context.lock); 195 mutex_lock(&mm->context.lock);
198 if (ldt_info.entry_number >= (unsigned)mm->context.size) { 196 if (ldt_info.entry_number >= mm->context.size) {
199 error = alloc_ldt(&current->mm->context, 197 error = alloc_ldt(&current->mm->context,
200 ldt_info.entry_number + 1, 1); 198 ldt_info.entry_number + 1, 1);
201 if (error < 0) 199 if (error < 0)