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

From: Borislav Petkov

Date: Mon Mar 23 2026 - 12:44:47 EST


On Mon, Mar 23, 2026 at 03:52:04PM +0000, Maciej Wieczor-Retman wrote:
> It could be a problem if another entry is added that doesn't have the string
> specified? Other spots that return either the string or the word:bit format do
> check before if (!x86_cap_name[x]) isn't true. Is it not checked here on
> purpose? Or is cpuid_dependent_features[] not expected to grow in the future?

Yes, maybe, no...

The point is, when you write commit messages, you should *precisely* explain
what the issue or the non-issue is. What you have now is misleading - it
should say what you just wrote above - that this could *potentially* be
a problem but it isn't a problem now.

> Right, sorry. Perhaps setting it to 24 would make sense? I think the longest
> right now is 19, So there'd be some extra space in case a longer string is added
> later?

The use being?

Nothing's stopping someone from slapping a longer name in "" in cpufeatures.h

As long as you select a size and you enforce it somewhere and scream loudly
when someone overflows it, then that's good. Otherwise what's the point of
calling it anything if it is not being enforced?

> Sure, I can switch the name to x86_feature_name(). But I assume keeping it in
> common.c makes sense? Since it could be used there mostly and at that point it's
> more generic and not related to cpuid-deps specifically.

Right, makes sense.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette