From patchwork Fri Jan 22 01:43:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 1430154 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=WJXwGeag; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DMMVQ67Ypz9sCD for ; Fri, 22 Jan 2021 12:43:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E6330828D1; Fri, 22 Jan 2021 02:43:39 +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="WJXwGeag"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1EBE8828D6; Fri, 22 Jan 2021 02:43:39 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) (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 705DA828B0 for ; Fri, 22 Jan 2021 02:43:36 +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=takahiro.akashi@linaro.org Received: by mail-pf1-x42c.google.com with SMTP id i63so2665153pfg.7 for ; Thu, 21 Jan 2021 17:43:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=m97JsVYu/DLbMXjA0wm2XpO39uMLpJUYGfrQgefEe5o=; b=WJXwGeagURDxzKhNEv6m5UXLU0Na+yBo497ck7Rmmynuj6hQdLYuBDqgTZRTpI9PZS K10OAcrzqOhsRsxjZrbJ91SGY72E/MIhi3HyBQ5n0v4cwE0EWeBVEoVsGMlfrAcQSGH9 e4j9v+uGFG9S3F0NBed8jsySn8qoeRedMNIdlKS2Y5Jp0ya00aVkAvtC3NrrdeyXtU8j Iisq/nASXSekuHrwOseQ59HAgESEOV6TR5oaqPlZ16Cj5DPbXJ2ebgITflp2SMmANt+K aXdSuNeze9qCwCqM1u0IkaAOuDDHKlX3HnMJtEzUgMVj9JuIarnlREf6/Yjp6LMsde1a /X4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=m97JsVYu/DLbMXjA0wm2XpO39uMLpJUYGfrQgefEe5o=; b=hnWryRfMtVLTY3m01Gm7w5OgzvJPdrad2afcXci9WyVlYghx7uDsHN+sCnnQgq/BVC YVPPninTUddfm5dmrQ3BRoMkxkZDaC11s9JVx9HHD8k5wFwDbVcVtopHg0qMZt7Lbn3t z1cgJYnEcEECAibL+Chh0DF8Pol4SsjSUB+rlpfJ63XtNEBKZbsU0TKAXVJvdDuG8H44 HE5vS4A6lbdWvF4ePRHTOWfAtWvS+pUv/7JY3f1FDs+5MYKtvQU9JdENo9DhQVgTFauz 7LXHKrReJqpo35RZ//bvGSpiR10PpVzbtQeuYXdQpPNbZ0+1E4rJ5OG7e/HF3F/jT1Ia APTQ== X-Gm-Message-State: AOAM533VaVABRkwxMf23L/1QCqKUw8s7TsjjvJCsJNdp3RHJBJAII9kj G7W5qL64rPaplfIvJQDtnhqCXie3CBZRsQ== X-Google-Smtp-Source: ABdhPJyOQHSpO1EHJ2DsJWrVIGhrw0RYUF52fL7/fwxOgC4hIE5v1gYwI9BxnLIrwFTkcBOFxfWPwQ== X-Received: by 2002:a63:1a10:: with SMTP id a16mr2127647pga.317.1611279814849; Thu, 21 Jan 2021 17:43:34 -0800 (PST) Received: from localhost.localdomain (p73a21355.tkyea130.ap.so-net.ne.jp. [115.162.19.85]) by smtp.gmail.com with ESMTPSA id 85sm6990245pfc.39.2021.01.21.17.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 17:43:34 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, xypron.glpk@gmx.de, agraf@csgraf.de Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH] efi_loader: capsule: fix SIZEOF_MISMATCH warning Date: Fri, 22 Jan 2021 10:43:27 +0900 Message-Id: <20210122014327.20589-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean CID 316361 says: > Passing argument "count * 8UL /* sizeof (*files) */" to > function "dlmalloc" and then casting the return value to "u16 **" is > suspicious. In this particular case "sizeof (u16 **)" happens to be equal > to "sizeof (u16 *)", but this is not a portable assumption. > > 767 tmp_files = malloc(count * sizeof(*files)); The change in this patch fixes the ambiguity. Signed-off-by: AKASHI Takahiro Fixes: CID 316361 Reviewed-by: Heinrich Schuchardt --- lib/efi_loader/efi_capsule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index dad1b0fcf7c0..95413c50f89a 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -764,7 +764,7 @@ static efi_status_t efi_capsule_scan_dir(u16 ***files, unsigned int *num) goto err; /* make a list */ - tmp_files = malloc(count * sizeof(*files)); + tmp_files = malloc(count * sizeof(tmp_files[0])); if (!tmp_files) { ret = EFI_OUT_OF_RESOURCES; goto err;