Re: [PATCH] keys/trusted/tpm2: rename "bool" to "boolean"
From: Jarkko Sakkinen
Date: Tue Nov 10 2026 - 07:42:21 EST
On Tue, Nov 10, 2026 at 11:00:34AM +0000, David Laight wrote:
> Hmmm... how can that fail?
> bool[] is just "\1\1\1".
> I bet asn1_encode_bool() isn't inlined - where the compiler would optimise
> most of it away.
>
> It is a horrid variable name, asn1_bool_true[] would be better.
>
> David
Agreed.
ASN.1 deocoder (scripts/asn1_compiler.c) is ugly but elegant (it is) ;-)
Encoding side, well... It would for sure could benefit from some fresh
thinking but more like a turnover than fixing up few variable names
here and there, or addressing other cosmetic/minor details.
I'll put a remark on this to my personal TODO list. I'm doing a couple
of such turnovers for keyrings ATM [1][2], which will keep me busy still
for a while. This is my "post-LLM" strategy now at its core: "when you
see a bug, fix the vector".
If you have a great "big picture" idea on how to do encoding better
overall, I'm happy to look at such patches.
[1] https://lore.kernel.org/keyrings/20261110053323.2936729-1-jarkko@xxxxxxxxxx/
[2] https://lore.kernel.org/keyrings/20261108222719.304712-1-jarkko@xxxxxxxxxx/
Br, Jarkko