From patchwork Thu Feb 2 09:24:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 649656 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp135701pva; Thu, 2 Feb 2023 01:26:33 -0800 (PST) X-Google-Smtp-Source: AK7set9IrBrVKirMkOpWwdZ6vQ6CDXTZr9QnOK7tjboNEGJTrheyuVy3qpSG9NAfSWIZbTuRsC/3 X-Received: by 2002:a05:6870:c1d2:b0:15f:bcf0:86c5 with SMTP id i18-20020a056870c1d200b0015fbcf086c5mr2598749oad.56.1675329992946; Thu, 02 Feb 2023 01:26:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675329992; cv=none; d=google.com; s=arc-20160816; b=BteQ6wi521WYlzmuco9nR2hibMDhA+lW35jBUnqYxi1VdpKL3NYfW/61fjUV8NNOUF Hqnl+lanqkYHCG5Bu8IpZDg3H6P9ecyzLVhNdNiYdmbgcySWa74KKemjiNiPX/wuxrZe 3VCJd9VZhnbdfvFVhSpXiM4Yxe00ywz0d6Nt4qaqsMYaoZX8RhArif142nx6Hvk7JRxt D/vMKfRRAliqRgIcfGueRRjoYHGeaafZd1Lv2nc6xExCf3boCUQCSTE+h26G6S6e5WDe kNcWG+FQcckK6qbImceLcxbSySd8bZTAPXtaRA7rIoc+UNBCuaewYmwXrrHcPwIOHqDM k3LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=TmiucDsYYK/JRfcyUDrXxMALN0RXoY9kaNm3Vr+SeCU=; b=vGtvAyJi+35d3g+quE6QCOFYM6XV2CTU679yaSTHNcdrGXgdMmfn2GPZjdWgMnlXdA 4zsxJpcl/0Uds/yLaos2XJu4It38P1LBGET2iFxUOEpvvd+AMEHrGDN4MtEs3VmajYn3 ugLsXqR7Pi8w5GJsCn1E5TPpE43XEthMiISMUU3qmf4rimsNvKVReQm3RqB812Z76mbc 3NZ4R/9+KEE627TGtpV5Fb59rsfNA+56ulVzturTR7sXE1uaNdEqI2O9fVZqzQ7Dje71 UZv8fp5aWTI0wQDV+OS3ivn1pZjQGtkFEe2S3dhIf0yZgnD8HRpERMsSiEx+951/vkAU l5Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aARNZS0H; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id mt14-20020a0568706b0e00b00143ae47975csi19027447oab.171.2023.02.02.01.26.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Feb 2023 01:26:32 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aARNZS0H; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0A09785EFE; Thu, 2 Feb 2023 10:25:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="aARNZS0H"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 57B6585ED6; Thu, 2 Feb 2023 10:25:18 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D732885EDE for ; Thu, 2 Feb 2023 10:25:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pj1-x102c.google.com with SMTP id 88so1331181pjo.3 for ; Thu, 02 Feb 2023 01:25:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=TmiucDsYYK/JRfcyUDrXxMALN0RXoY9kaNm3Vr+SeCU=; b=aARNZS0HGFjaY1i7PpfsUXZ2ZyYCRu070YPNmyKqPO639NcXRuh1G4i16PsgtB9XWR uLhqW6uOtbBdPgtZ7AOCbzq3iRCQ7PVI+JBK9OZyLY7UvcbcotqzeHZAkXNOr71vVr5l Jz1pn7IERkx90MS6bgFrerABNKP4SawG/4e2f+HE3101zTpOpsvlTtad2/vnRd7exrR9 oA70vDUbRkkXDYlUde1+JH42D//EsTxipNPqI2Qjk3tXwWCj19eT4wDR4lGnNQPrZeZK ecfLyBIp9FBFjLzxAarejYq591cx7bY+GP0FqfXtmFeV1beJrM3w0/t9SRgWbvsffKmb eKnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TmiucDsYYK/JRfcyUDrXxMALN0RXoY9kaNm3Vr+SeCU=; b=f08eTHUbZPMo0xPZDsN02X2oqQO4jyYrGIr1Yc640Gudugi/8F7hrHdk3TDo85s83e GJ01zKxTjlgll0mEImeS/Eo2J9SaNf9Dk6oH8nj9RLTGQVnSNJxsG00V6O2+2LeIduhQ IJlrx7Ge6ENrriRl4SMOLnF7DiWNVkcvdUtKEE6pLKbaeSQlJ9CHE81DE/hLjJMND32J vaQDbXuVKvERk8NL0uxhDr4tqvKT7lpIrWaOZnaq7f6YoKNH79L1psuGImHPG9w3sctP njH3aWHGL9zEo0zNBqMjmeKjQAIxLhLPViH2OK3XEv0S6l43hc091MyE3ysPJxUYRJUT tJyw== X-Gm-Message-State: AO0yUKW46ofVl7gsCdzMku+Um4zt+bS5fecVWmDqvK/UfPdn3LQ0qL0n EsuhpmeYdXi0eS/exwDjTSnTThruSi+5P8+NbRo= X-Received: by 2002:a17:902:da85:b0:198:b99c:f6ee with SMTP id j5-20020a170902da8500b00198b99cf6eemr3996392plx.65.1675329912964; Thu, 02 Feb 2023 01:25:12 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id w4-20020a170902a70400b0019619f27525sm13120349plq.302.2023.02.02.01.25.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Feb 2023 01:25:12 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Masahisa Kojima Subject: [PATCH 3/5] eficonfig: set EFICONFIG_ENTRY_NUM_MAX to INT_MAX - 1 Date: Thu, 2 Feb 2023 18:24:45 +0900 Message-Id: <20230202092447.28590-4-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230202092447.28590-1-masahisa.kojima@linaro.org> References: <20230202092447.28590-1-masahisa.kojima@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean 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 --- 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))