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: 368606 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp1078038jam; Thu, 21 Jan 2021 17:43:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCJ59wABfcYusra/6O1HAmg5HGHYoPmhlCnqUGNK+dzXM7w/bGRg2nXNTzi0c+CG/nDmeG X-Received: by 2002:aa7:df86:: with SMTP id b6mr1524999edy.4.1611279820671; Thu, 21 Jan 2021 17:43:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611279820; cv=none; d=google.com; s=arc-20160816; b=TZebudf2eGz4cChz9fEc/BYfvod5WcrPQcdh4cRbQvhsyI8rWIOxFIvOFuZpfZT5s+ 5Q+91B8/FBdyZhM2tCvg1snuS5+dgDP8C41Rgal6LMzwTMb9RlcPcim1E5Tuv08Zyr81 0uK0QAFDh5a+fRLQV3UWSMXR58eAb8htEeIGxUOR/9c7Pc+zflk0oOoJfyp4K/h9CGk5 p5SMlbXRffYwWWs4wikiig8rr8ilWa0TKl31ZsgVYyFW44poUNNb8jRTzeISYv3KDX9u Aje0WzC6/RU4EshjZIW+0OfzQxdQxWmGpS9uPCLWFNhS1n9i6HVGqw2xPCk/Hj9X46Rr CduQ== 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:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=m97JsVYu/DLbMXjA0wm2XpO39uMLpJUYGfrQgefEe5o=; b=cjWO+Au4wzDVb/vm0O35VZVMvs5XA8mayeObqXBjuJsYNuyVsW1z3Cpe+EQSrojcDU TfpAaD6fctCkjuk+lIQcVyplVqhv72UwvIUsD2TVMpVDoB1dwF0MKSPHVpGPtGP4W4W/ iB6XrJ+9Fcuv4ZE9PDQ32JK5RlbQew4X6t4v3tSL7aGa0yQ7NR7a21g4G73epJUcsxdK w+bL9NoPVCshs95yuXyfFa1U6kKv1Fokv3PZD++l4XiV9NnF27mSvtdwWHabRiWTk6Dd hGRm4pF3nRdh8M6rbxisMfnlTlFe+xr/VPkK6g5bAmCsy8MpsX4p7MuDlUIxZq0ZCBBn 66Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WJXwGeag; 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 qk25si2420338ejb.422.2021.01.21.17.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 17:43:40 -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=WJXwGeag; 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 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-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 --- lib/efi_loader/efi_capsule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.28.0 Reviewed-by: Heinrich Schuchardt 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;