All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
To: u-boot@lists.denx.de
Cc: Steffen Jaeckel <jaeckel-floss@eyet-services.de>,
	Simon Glass <sjg@chromium.org>, Da Xue <da@libre.computer>,
	Heiko Schocher <hs@denx.de>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Joel Peshkin <joel.peshkin@broadcom.com>,
	"Yuezhang.Mo@sony.com" <Yuezhang.Mo@sony.com>
Subject: [PATCH v4 4/8] common: Rename macro appropriately
Date: Thu,  8 Jul 2021 01:09:42 +0200	[thread overview]
Message-ID: <20210707230946.2497660-5-jaeckel-floss@eyet-services.de> (raw)
In-Reply-To: <20210707230946.2497660-1-jaeckel-floss@eyet-services.de>

While doing code-review internally this got nitpicked by 2 reviewers, so
I decided to include this here.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 common/autoboot.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/common/autoboot.c b/common/autoboot.c
index 107fb1533d..832ef7c78c 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -27,7 +27,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define MAX_DELAY_STOP_STR 64
+#define DELAY_STOP_STR_MAX_LENGTH 64
 
 #ifndef DEBUG_BOOTKEYS
 #define DEBUG_BOOTKEYS 0
@@ -69,7 +69,7 @@ static int menukey;
 static int passwd_abort_crypt(uint64_t etime)
 {
 	const char *crypt_env_str = env_get("bootstopkeycrypt");
-	char presskey[MAX_DELAY_STOP_STR];
+	char presskey[DELAY_STOP_STR_MAX_LENGTH];
 	u_int presskey_len = 0;
 	int abort = 0;
 	int err;
@@ -150,9 +150,9 @@ static int passwd_abort_sha256(uint64_t etime)
 	if (sha_env_str == NULL)
 		sha_env_str = CONFIG_AUTOBOOT_STOP_STR_SHA256;
 
-	presskey = malloc_cache_aligned(MAX_DELAY_STOP_STR);
+	presskey = malloc_cache_aligned(DELAY_STOP_STR_MAX_LENGTH);
 	c = strstr(sha_env_str, ":");
-	if (c && (c - sha_env_str < MAX_DELAY_STOP_STR)) {
+	if (c && (c - sha_env_str < DELAY_STOP_STR_MAX_LENGTH)) {
 		/* preload presskey with salt */
 		memcpy(presskey, sha_env_str, c - sha_env_str);
 		presskey_len = c - sha_env_str;
@@ -179,7 +179,7 @@ static int passwd_abort_sha256(uint64_t etime)
 	do {
 		if (tstc()) {
 			/* Check for input string overflow */
-			if (presskey_len >= MAX_DELAY_STOP_STR) {
+			if (presskey_len >= DELAY_STOP_STR_MAX_LENGTH) {
 				free(presskey);
 				free(sha);
 				return 0;
@@ -223,7 +223,7 @@ static int passwd_abort_key(uint64_t etime)
 		{ .str = env_get("bootstopkey"),   .retry = 0 },
 	};
 
-	char presskey[MAX_DELAY_STOP_STR];
+	char presskey[DELAY_STOP_STR_MAX_LENGTH];
 	int presskey_len = 0;
 	int presskey_max = 0;
 	int i;
@@ -240,8 +240,8 @@ static int passwd_abort_key(uint64_t etime)
 	for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i++) {
 		delaykey[i].len = delaykey[i].str == NULL ?
 				    0 : strlen(delaykey[i].str);
-		delaykey[i].len = delaykey[i].len > MAX_DELAY_STOP_STR ?
-				    MAX_DELAY_STOP_STR : delaykey[i].len;
+		delaykey[i].len = delaykey[i].len > DELAY_STOP_STR_MAX_LENGTH ?
+				    DELAY_STOP_STR_MAX_LENGTH : delaykey[i].len;
 
 		presskey_max = presskey_max > delaykey[i].len ?
 				    presskey_max : delaykey[i].len;
-- 
2.32.0


  parent reply	other threads:[~2021-07-07 23:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 23:09 [PATCH v4 0/8] common: Introduce crypt-style password support Steffen Jaeckel
2021-07-07 23:09 ` [PATCH v4 1/8] lib: add crypt subsystem Steffen Jaeckel
2021-07-08  3:56   ` Heiko Schocher
2021-07-08 11:43     ` Steffen Jaeckel
2021-07-08 11:50       ` Heiko Schocher
2021-07-07 23:09 ` [PATCH v4 2/8] lib: wrap crypt API to hide errno usage Steffen Jaeckel
2021-07-08  3:58   ` Heiko Schocher
2021-07-07 23:09 ` [PATCH v4 3/8] common: integrate crypt-based passwords Steffen Jaeckel
2021-07-08  4:00   ` Heiko Schocher
2021-07-07 23:09 ` Steffen Jaeckel [this message]
2021-07-08  4:04   ` [PATCH v4 4/8] common: Rename macro appropriately Heiko Schocher
2021-07-07 23:09 ` [PATCH v4 5/8] common: allow disabling of timeout for password entry Steffen Jaeckel
2021-07-07 23:09 ` [PATCH v4 6/8] common: add AUTOBOOT_FLUSH_STDIN option Steffen Jaeckel
2021-07-07 23:09 ` [PATCH v4 7/8] common: add support to fallback to plain SHA256 Steffen Jaeckel
2021-07-07 23:09 ` [PATCH v4 8/8] test: add first autoboot unit tests Steffen Jaeckel

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=20210707230946.2497660-5-jaeckel-floss@eyet-services.de \
    --to=jaeckel-floss@eyet-services.de \
    --cc=Yuezhang.Mo@sony.com \
    --cc=da@libre.computer \
    --cc=hs@denx.de \
    --cc=joel.peshkin@broadcom.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.