From: Jarkko Sakkinen <jarkko@kernel.org>
To: Wei Wang <wei.w.wang@intel.com>
Cc: arnd@arndb.de, akpm@linux-foundation.org, keescook@chromium.org,
herbert@gondor.apana.org.au, josh@joshtriplett.org,
jani.nikula@intel.com, corbet@lwn.net, jgg@mellanox.com,
dmatlack@google.com, mizhang@google.com, pbonzini@redhat.com,
seanjc@google.com, linux-kernel@vger.kernel.org,
James.Bottomley@hansenpartnership.com
Subject: Re: [PATCH v1 1/3] security: keys: don't use data type as variable name
Date: Sun, 12 Mar 2023 00:13:46 +0200 [thread overview]
Message-ID: <ZAz9Gi/nHL8TLrRn@kernel.org> (raw)
In-Reply-To: <20230304041932.847133-2-wei.w.wang@intel.com>
On Sat, Mar 04, 2023 at 12:19:30PM +0800, Wei Wang wrote:
> 'bool' is a specific name for the data type that is an alias for
> the C99 _Bool type. It shoudn't be used as variable names as that causes
> too much confusion either for the reader or the compilier.
>
> CC: James.Bottomley@HansenPartnership.com
> CC: jarkko@kernel.org
> Fixes: f2219745250f ("security: keys: trusted: use ASN.1 TPM2 key format for the blobs")
> Signed-off-by: Wei Wang <wei.w.wang@intel.com>
> ---
> security/keys/trusted-keys/trusted_tpm2.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/security/keys/trusted-keys/trusted_tpm2.c b/security/keys/trusted-keys/trusted_tpm2.c
> index 2b2c8eb258d5..390d7314f5a6 100644
> --- a/security/keys/trusted-keys/trusted_tpm2.c
> +++ b/security/keys/trusted-keys/trusted_tpm2.c
> @@ -54,12 +54,13 @@ static int tpm2_key_encode(struct trusted_key_payload *payload,
> asn1_oid_len(tpm2key_oid));
>
> if (options->blobauth_len == 0) {
> - unsigned char bool[3], *w = bool;
> + unsigned char bool_val[3], *w = bool_val;
> /* tag 0 is emptyAuth */
> w = asn1_encode_boolean(w, w + sizeof(bool), true);
> if (WARN(IS_ERR(w), "BUG: Boolean failed to encode"))
> return PTR_ERR(w);
> - work = asn1_encode_tag(work, end_work, 0, bool, w - bool);
> + work = asn1_encode_tag(work, end_work, 0,
> + bool_val, w - bool_val);
> }
>
> /*
> --
> 2.27.0
>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@kernel.org>
BR, Jarkko
next prev parent reply other threads:[~2023-03-11 22:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-04 4:19 [PATCH v1 0/3] Regarding using 'bool' appropriately Wei Wang
2023-03-04 4:19 ` [PATCH v1 1/3] security: keys: don't use data type as variable name Wei Wang
2023-03-11 22:13 ` Jarkko Sakkinen [this message]
2023-03-04 4:19 ` [PATCH v1 2/3] Documentation/CodingStyle: do not use data type names as variable names Wei Wang
2023-03-04 15:01 ` Jonathan Corbet
2023-03-06 11:03 ` Wang, Wei W
2023-03-04 4:19 ` [PATCH v1 3/3] bug: use bool for __ret_warn_on in WARN/WARN_ON Wei Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZAz9Gi/nHL8TLrRn@kernel.org \
--to=jarkko@kernel.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=corbet@lwn.net \
--cc=dmatlack@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=jani.nikula@intel.com \
--cc=jgg@mellanox.com \
--cc=josh@joshtriplett.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mizhang@google.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=wei.w.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox