Commit 5d703825 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

x86/alternatives: Clean up preprocessor conditional block comments



When in the middle of a kernel source code file a kernel developer
sees a lone #else or #endif:

   ...

   #else

   ...

It's not obvious at a glance what those preprocessor blocks are
conditional on, if the starting #ifdef is outside visible range.

So apply the standard pattern we use in such cases elsewhere in
the kernel for large preprocessor blocks:

  #ifdef CONFIG_XXX
  ...
  ...
  ...
  #endif /* CONFIG_XXX */

  ...

  #ifdef CONFIG_XXX
  ...
  ...
  ...
  #else /* !CONFIG_XXX: */
  ...
  ...
  ...
  #endif /* !CONFIG_XXX */

( Note that in the  #else case we use the /* !CONFIG_XXX */ marker
  in the final #endif, not /* CONFIG_XXX */, which serves as an easy
  visual marker to differentiate #else or #elif related #endif closures
  from singular #ifdef/#endif blocks. )

Also clean up __CFI_DEFAULT definition with a bit more vertical alignment
applied, and a pointless tab converted to the standard space we use in
such definitions.

Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
parent 500a41ac
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -839,16 +839,16 @@ void __init_or_module noinline apply_returns(s32 *start, s32 *end)
		}
	}
}
#else
#else /* !CONFIG_MITIGATION_RETHUNK: */
void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }
#endif /* CONFIG_MITIGATION_RETHUNK */
#endif /* !CONFIG_MITIGATION_RETHUNK */

#else /* !CONFIG_MITIGATION_RETPOLINE || !CONFIG_OBJTOOL */

void __init_or_module noinline apply_retpolines(s32 *start, s32 *end) { }
void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }

#endif /* CONFIG_MITIGATION_RETPOLINE && CONFIG_OBJTOOL */
#endif /* !CONFIG_MITIGATION_RETPOLINE || !CONFIG_OBJTOOL */

#ifdef CONFIG_X86_KERNEL_IBT

@@ -916,11 +916,11 @@ void __init_or_module noinline apply_seal_endbr(s32 *start, s32 *end)
	}
}

#else
#else /* !CONFIG_X86_KERNEL_IBT: */

void __init_or_module apply_seal_endbr(s32 *start, s32 *end) { }

#endif /* CONFIG_X86_KERNEL_IBT */
#endif /* !CONFIG_X86_KERNEL_IBT */

#ifdef CONFIG_CFI_AUTO_DEFAULT
# define __CFI_DEFAULT CFI_AUTO
@@ -1457,7 +1457,7 @@ bool decode_fineibt_insn(struct pt_regs *regs, unsigned long *target, u32 *type)
	return false;
}

#else
#else /* !CONFIG_FINEIBT: */

static void __apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
			    s32 *start_cfi, s32 *end_cfi, bool builtin)
@@ -1468,7 +1468,7 @@ static void __apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
static void poison_cfi(void *addr) { }
#endif

#endif
#endif /* !CONFIG_FINEIBT */

void apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
		   s32 *start_cfi, s32 *end_cfi)