Re: [PATCH] x86/ucode: replace redundant string literals

From: Jan Beulich
Date: Tue Dec 22 2015 - 12:20:43 EST


>>> On 22.12.15 at 18:07, <bp@xxxxxxx> wrote:
> On Tue, Dec 22, 2015 at 08:40:43AM -0700, Jan Beulich wrote:
>> This doesn't just eliminate needless redundancy
>> (plus avoid a possible disconnect if one string instance gets changed
>> without the other(s)),
>
> This argument is bogus. We will never ever change a user-visible command
> line option. Ever.
>
>> but also eliminates a warning some gcc versions emit ("array access
>> beyond array bounds", observed with 4.3.4) in the 32-bit case.
>
> Now that I'm interested in - how exactly do you trigger this? gcc
> version, etc?

As said - 4.3.4 (I only now realize that this could also have been a
kernel version).

>> --- 4.4-rc6/arch/x86/kernel/cpu/microcode/core.c
>> +++ 4.4-rc6-x86-ucode-early-string/arch/x86/kernel/cpu/microcode/core.c
>> @@ -83,13 +83,11 @@ static bool __init check_loader_disabled
>> {
>> #ifdef CONFIG_X86_32
>> const char *cmdline = (const char *)__pa_nodebug(boot_command_line);
>> - const char *opt = "dis_ucode_ldr";
>> - const char *option = (const char *)__pa_nodebug(opt);
>> + const char *option = (const char *)__pa_nodebug(__setup_str_disable_loader);
>> bool *res = (bool *)__pa_nodebug(&dis_ucode_ldr);
>> -
>> #else /* CONFIG_X86_64 */
>> const char *cmdline = boot_command_line;
>> - const char *option = "dis_ucode_ldr";
>> + const char *option = __setup_str_disable_loader;
>> bool *res = &dis_ucode_ldr;
>> #endif
>
> I don't like it: it is not clear at a glance that this __setup_str*
> magic gets generated from the __setup macro. In addition, this code is
> as unreadable as it is now - your patch makes it even more cryptic.
>
> I much prefer the redundancy.

And the compiler warning? At the very least these should then be
const char __initconst [].

Jan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/