Re: [PATCH v11 2/4] x86/cpu: Check if feature string is non-zero

From: H. Peter Anvin

Date: Mon Mar 23 2026 - 14:55:46 EST


On March 23, 2026 11:11:33 AM PDT, Maciej Wieczor-Retman <m.wieczorretman@xxxxx> wrote:
>On 2026-03-23 at 18:51:51 +0100, Borislav Petkov wrote:
>>On Mon, Mar 23, 2026 at 04:58:20PM +0000, Maciej Wieczor-Retman wrote:
>>> Ah sorry, it's a bit of a misunderstanding, the X86_CAP_BUF_SIZE refers only to
>>> the value that's needed for a buffer when the word:bit format is returned.
>>> Otherwise the const char * is returned from the x86_cap_flags[] array.
>>
>>Yes, I know that. That's why I said:
>>
>>"But this macro name is generically saying, this is the cap string size. Which
>>makes it misleading."
>>
>>> So I guess the constant name should be different? Maybe X86_CAP_NUM_BUF_SIZE?
>>
>>#define X86_NAMELESS_FEAT_STRLEN
>>
>>or so.
>>
>>Your naming must be explicit and denote for what this is used.
>>
>>--
>>Regards/Gruss,
>> Boris.
>>
>>https://people.kernel.org/tglx/notes-about-netiquette
>
>Thanks! I'll correct it
>

Call it "BUF" or "BUFLEN". It's not the length of the string, but the length of the buffer for the caller to allocate.