From 1f0583beeb32b0eab4d87ea9c0bef247432aa0c6 Mon Sep 17 00:00:00 2001 From: Masahisa Kojima Date: Thu, 2 Feb 2023 18:24:45 +0900 Subject: [PATCH] eficonfig: set EFICONFIG_ENTRY_NUM_MAX to INT_MAX - 1 eficonfig_append_menu_entryi() accepts the number of entries less than or equal to EFICONFIG_ENTRY_NUM_MAX. EFICONFIG_ENTRY_NUM_MAX is currently set as INT_MAX, so the invalid menu count check(efi_menu->count > EFICONFIG_ENTRY_NUM_MAX) in eficonfig_process_common() is always false. This commit sets EFICONFIG_ENTRY_NUM_MAX to (INT_MAX - 1). Reported-by: Coverity (CID 435659) Signed-off-by: Masahisa Kojima Reviewed-by: Heinrich Schuchardt --- include/efi_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/efi_config.h b/include/efi_config.h index e5edbb5e09..01ce9b2b06 100644 --- a/include/efi_config.h +++ b/include/efi_config.h @@ -11,7 +11,7 @@ #include #include -#define EFICONFIG_ENTRY_NUM_MAX INT_MAX +#define EFICONFIG_ENTRY_NUM_MAX (INT_MAX - 1) #define EFICONFIG_VOLUME_PATH_MAX 512 #define EFICONFIG_FILE_PATH_MAX 512 #define EFICONFIG_FILE_PATH_BUF_SIZE (EFICONFIG_FILE_PATH_MAX * sizeof(u16)) -- 2.39.5