Re: [PATCH 1/5] x86/alternative: simplify DUMP_BYTES macro

From: Thomas Gleixner
Date: Tue Apr 05 2022 - 17:53:45 EST


On Fri, Mar 11 2022 at 17:43, Alexey Dobriyan wrote:
> Avoid zero length check with clever whitespace placement in the format
> string.
>
> Signed-off-by: Alexey Dobriyan (CloudLinux) <adobriyan@xxxxxxxxx>
> ---
> arch/x86/kernel/alternative.c | 21 +++++++++------------
> 1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index 5007c3ffe96f..6c9758ee6810 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -66,13 +66,10 @@ do { \
> if (unlikely(debug_alternative)) { \
> int j; \
> \
> - if (!(len)) \
> - break; \
> - \

How does that clever whitespace placement prevent this being printed in
the len == 0 case, which is a legit case?

> printk(KERN_DEBUG pr_fmt(fmt), ##args); \

This is debug muck. So why does it have to be "optimized"?

Thanks,

tglx