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

Mark Brown broonie at kernel.org
Mon Nov 23 07:57:29 PST 2026


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>

Reviewed-by: Mark Brown <broonie at kernel.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20261123/ee465476/attachment.sig>


More information about the linux-arm-kernel mailing list