[PATCH 6/9] arm64: sysreg: Reject an enum value not written at its field's width

Fuad Tabba fuad.tabba at linux.dev
Mon Nov 23 02:47:18 PST 2026


Hi Steffen,

On Mon, 23 Nov 2026 at 10:45, Steffen Eiden <seiden at linux.ibm.com> wrote:
>
> On Mon, Nov 23, 2026 at 07:52:16AM +0000, Fuad Tabba wrote:
> > The generator emits each enum value as written and doesn't check it
> > against the width of its field, so a value wider than the field defines
> > a constant the field can't hold. The duplicate value check compares the
> > strings as written, so 0b01 and 0b001 in the same field pass as distinct
> > values, and the rule's pattern, an unanchored /0b[01]+/, accepts 0b12
> > too.
> >
> > Require each value to be 0b followed by exactly as many binary digits as
> > its field has bits. The one enum written otherwise is TS, a two-bit
> > field of TRFCR_EL1 and TRFCR_EL2 whose values have four digits. Write
> > them with two digits, which leaves the numbers unchanged.
> >
> > Signed-off-by: Fuad Tabba <fuad.tabba at linux.dev>
> > ---
> >  arch/arm64/tools/gen-sysreg.awk |  3 +++
> >  arch/arm64/tools/sysreg         | 14 +++++++-------
> >  2 files changed, 10 insertions(+), 7 deletions(-)
> >
>
> Lets split this patch into two:
>
> 1. Fix the bitwidth of the Enums
> 2. Add the new check to the awk script
>
> Then the fix is split apart from the enforcement.

Ack.

Thanks for the reviews!
/fuad



More information about the linux-arm-kernel mailing list