common: Rename macro appropriately

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>
Reviewed-by: Heiko Schocher <hs@denx.de>
This commit is contained in:
Steffen Jaeckel 2021-07-08 15:57:36 +02:00 committed by Tom Rini
parent 1a4a778666
commit 1b2d68033b

View file

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