Re: [PATCH v2 07/10] arm64: sysreg: Reject an enum value not written at its field's width

From: Steffen Eiden

Date: Fri Nov 27 2026 - 09:27:49 EST


On Fri, Nov 27, 2026 at 07:44:23AM +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. Test it in the rule's action rather than by
> tightening the pattern, so that a value such as 0b12 is reported with
> its field's width, instead of falling to the generic "unhandled
> statement" error.
>
> Reviewed-by: Mark Brown <broonie@xxxxxxxxxx>
> Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>

Reviewed-by: Steffen Eiden <seiden@xxxxxxxxxxxxx>