[PATCH v2 2/4] arm64/sysreg: Enforce whole word match for open/close tokens
Marc Zyngier
maz at kernel.org
Fri Mar 14 00:40:36 PDT 2025
On 2025-03-13 21:56, Will Deacon wrote:
> On Wed, Jan 15, 2025 at 04:25:56PM +0000, James Clark wrote:
>> Opening and closing tokens can also match on words with common
>> prefixes
>> like "Endsysreg" vs "EndsysregFields". This could potentially make the
>> script go wrong in weird ways so make it fall through to the fatal
>> unhandled statement catcher if it doesn't fully match the current
>> block.
>>
>> Closing ones also get expect_fields(1) to ensure nothing other than
>> whitespace follows.
>>
>> Signed-off-by: James Clark <james.clark at linaro.org>
>> ---
>> arch/arm64/tools/gen-sysreg.awk | 31 +++++++++++++++++--------------
>> 1 file changed, 17 insertions(+), 14 deletions(-)
>>
>> diff --git a/arch/arm64/tools/gen-sysreg.awk
>> b/arch/arm64/tools/gen-sysreg.awk
>> index 1a2afc9fdd42..f2a1732cb1f6 100755
>> --- a/arch/arm64/tools/gen-sysreg.awk
>> +++ b/arch/arm64/tools/gen-sysreg.awk
>> @@ -111,7 +111,7 @@ END {
>> /^$/ { next }
>> /^[\t ]*#/ { next }
>>
>> -/^SysregFields/ && block_current() == "Root" {
>> +$1 == "SysregFields" && block_current() == "Root" {
>
> Stylistic nit, but could you just do:
>
> /^SysregFields$/ && block_current() == "Root" {
>
> instead? That way the diff is smaller (well, same number of lines) and
> you avoid the ugly $1.
The code is trying to match the first field of a line such as:
SysregFields ZCR_ELx
while you seem to try and match a SysregFields all alone on a line.
That being said, my perl-foo is sub-zero, so I may be very wrong myself.
M.
--
Jazz is not dead. It just smells funny...
More information about the linux-arm-kernel
mailing list