Skip to content

Commit

Permalink
x86/cpu: Do the feature test first in enable_sep_cpu()
Browse files Browse the repository at this point in the history
... before assigning local vars. Kill out label too and simplify.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1458130769-24963-1-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Borislav Petkov authored and Ingo Molnar committed Mar 29, 2016
1 parent 1993b17 commit b3edfda
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions arch/x86/kernel/cpu/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1076,12 +1076,12 @@ void enable_sep_cpu(void)
struct tss_struct *tss;
int cpu;

if (!boot_cpu_has(X86_FEATURE_SEP))
return;

cpu = get_cpu();
tss = &per_cpu(cpu_tss, cpu);

if (!boot_cpu_has(X86_FEATURE_SEP))
goto out;

/*
* We cache MSR_IA32_SYSENTER_CS's value in the TSS's ss1 field --
* see the big comment in struct x86_hw_tss's definition.
Expand All @@ -1096,7 +1096,6 @@ void enable_sep_cpu(void)

wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long)entry_SYSENTER_32, 0);

out:
put_cpu();
}
#endif
Expand Down

0 comments on commit b3edfda

Please sign in to comment.