Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2390106rdb; Mon, 12 Feb 2024 03:25:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUZXJLgUKACR7t2Z3iILsKyOvlt0mIe3k/xtCEd6Fvg2qV5iNylDl4qDJT1zdojuaN0tU7y+9EuN31KdUdq65EJYZAsVKg/9tvCyLnFLA== X-Google-Smtp-Source: AGHT+IEN5wPFKv0qAEJEDzk+oHHsd/003rve9FJ4bIBIC0wOokpg+IxoeoWRoDOgEQSb95q6P9/U X-Received: by 2002:a2e:9217:0:b0:2d0:f614:9a67 with SMTP id k23-20020a2e9217000000b002d0f6149a67mr2175876ljg.39.1707737108164; Mon, 12 Feb 2024 03:25:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707737108; cv=pass; d=google.com; s=arc-20160816; b=ycAcgOCFx6eWfIc+jmy98eh0uyDGZbJSOXMLYLGQb+mxG+K4XBpdi6gTJMhksMRe6j LHNYBwfm+CxmVCjtrfLxYYyKhHla5gPXR/giPhgpJ4mAinAH8uwdJHp5+rp59a53OD7A vKPkc+BhMPssb5cqgTI7xqw2zEmMe2KZljnMq82ZKJ+IUqAeS93Rg3yF6eR1GdyNqcyE p+ImGr8EmHdFDy+C4VJWOuSUhEvypxZbzz0gyjFJtORsVD5Rzsw4gavRN2m9/w9oDYrV Qg/lpx8IuUag2Ksv8i8llQfOSKOgN1jAv/5Mt5qdSgRo5efgMqH+ZzUbXGkatlHrBEiA pJEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=zBfxIt/gJBXbTRjUQd+w6Aa0M7sQdlaBGBQrduzRJVc=; fh=rgfG7KBvZNvNazW5i5rgk//6j0p6hXA3QPQc/0LoPRk=; b=ZJLhSPA3XRWvvc579g/EPMXTbJdQwlwoQjAV/i40wj5ZKIMf0QsgKRQ4pfmuHPrhrc nmu86hfDZRRUihDo3SVpZE+RA1ueuVahRxVyo/dC1PmqGZpt/UORF7O5X6YHuo3WEvZR BIDXXzqvNB1LGvpJRJArtO2s24Klml1A/e6EGmpEDdwF8my3ePffWn58slurU4e3Lfo3 X1UzDzHJkqGNO1lEyEU7iZ9/wIsjCET39ahtRQLezsRVapk8GpBupUgMz3xTb37emxef Bpjyn7qSAI15HgAQIEvFrxGDHIg7g70wXFpZ6DZaEWk4qbSyU33tmzHWjgiTq9N6IbqT Z7ZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b+8jQASs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-61421-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61421-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCVH+PXwKydbzIqbZiNiHJYzCFmT/kXWge5lJPuZ4LBUtAmPjZuRv56ZuiGApIG19lTbIc8Nzin+9L49v0F3wmPdidY7wyzC+6fKz+Qd/A== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b21-20020aa7c915000000b005610fabe514si2523581edt.170.2024.02.12.03.25.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 03:25:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61421-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b+8jQASs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-61421-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61421-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E1D9A1F22F9C for ; Mon, 12 Feb 2024 11:25:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5BF0538FA0; Mon, 12 Feb 2024 11:25:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="b+8jQASs" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 859E32BAE7; Mon, 12 Feb 2024 11:24:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707737099; cv=none; b=nH95QBeIRFivMuI8ug1GJkl4Le5NokCRmkiMzjnhJ+p2GWzfsfwz5+VuYPRv3vb4hHENGw76lT7yRmXKaFukkprPgWfqg/OrjisK1nUTf6UPX5V6XHcPG97KE1L3tKF/b9Y+JmI1Misy52AmVVmhjCXhRdB3rXM2E4tSGZwkvxI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707737099; c=relaxed/simple; bh=ATEIqE2FYDHx4amPoL6rW+Wx6eEq3KOSbQzs0WhLrGI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=gzaF6tvxFFmWURRr0Dzz+1fH0sFgKu7H5Ca4DsoEo1VkOjmBZoysl4W+n3uBxKBClVVUL3QnJoKtcgC8IYLcsFqcsDkvjKjSarokpi5RrvHFv04Gs9dmUoz1crS4Qwq8QqNdul1Yd30Hvm2WGXHLOWLTWT8pHIJ0hPxvGdxoVjw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=b+8jQASs; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD9C1C433F1; Mon, 12 Feb 2024 11:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707737099; bh=ATEIqE2FYDHx4amPoL6rW+Wx6eEq3KOSbQzs0WhLrGI=; h=From:To:Cc:Subject:Date:From; b=b+8jQASs+XYTJoe4+xr9ps5KrmUppJwkCnsn6wlXL9dO6QVpkYGfTy4FUWd/YP7yd 71GrPNwFyPFLNcOi+YROhjDmLEDDVqVlExpcKHvrVh4hr3K0KFE/YXKI9279Fx8m5T 6sCC+J4CkXU4mjQsHu8Pd7SieDj0ZIhzvEMQqb+81KbDpZiHKCkOO5rsxCgqeCfh8d SHCoudX46no3TtnbSGegMkUUeie7jyL+P+uY6JblDEVagI20foItOySJ4ZuG7+0U2i LdCYNruvQkQ6MuWBJisg+i+sEXkkJemP338eAQFxNrCaLgwu8dylayqqqpO3Rdc5ck 0+56xcKH8VVmA== From: Arnd Bergmann To: Ard Biesheuvel , Ingo Molnar Cc: Arnd Bergmann , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] efi/capsule-loader: fix incorrect allocation size Date: Mon, 12 Feb 2024 12:24:40 +0100 Message-Id: <20240212112454.1213449-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arnd Bergmann gcc-14 notices that the allocation with sizeof(void) on 32-bit architectures is not enough for a 64-bit phys_addr_t: drivers/firmware/efi/capsule-loader.c: In function 'efi_capsule_open': drivers/firmware/efi/capsule-loader.c:295:24: error: allocation of insufficient size '4' for type 'phys_addr_t' {aka 'long long unsigned int'} with size '8' [-Werror=alloc-size] 295 | cap_info->phys = kzalloc(sizeof(void *), GFP_KERNEL); | ^ Use the correct type instead here. Fixes: f24c4d478013 ("efi/capsule-loader: Reinstate virtual capsule mapping") Signed-off-by: Arnd Bergmann --- drivers/firmware/efi/capsule-loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/capsule-loader.c b/drivers/firmware/efi/capsule-loader.c index 3e8d4b51a814..97bafb5f7038 100644 --- a/drivers/firmware/efi/capsule-loader.c +++ b/drivers/firmware/efi/capsule-loader.c @@ -292,7 +292,7 @@ static int efi_capsule_open(struct inode *inode, struct file *file) return -ENOMEM; } - cap_info->phys = kzalloc(sizeof(void *), GFP_KERNEL); + cap_info->phys = kzalloc(sizeof(phys_addr_t), GFP_KERNEL); if (!cap_info->phys) { kfree(cap_info->pages); kfree(cap_info); -- 2.39.2