From patchwork Mon Feb 12 11:24:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 199664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2366270dyd; Mon, 12 Feb 2024 03:26:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVvOFGBd82hpfFwRZ23ln9gaiS7phzoVEoehzIdCzStbT1osmTFpbENB8IoKhxNQRRnzhnCm+SwbxXcqc4CKcvniyY1+Q== X-Google-Smtp-Source: AGHT+IE7cvAhvgP8/XZcu+yrU9VN72wY4HGGpw9VWgHYyj0alQFza9ARIE7K5rgstJsFfdW9J8wc X-Received: by 2002:a05:6a20:c68e:b0:19e:9ae3:a169 with SMTP id gq14-20020a056a20c68e00b0019e9ae3a169mr5000555pzb.27.1707737214724; Mon, 12 Feb 2024 03:26:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707737214; cv=pass; d=google.com; s=arc-20160816; b=ScCsZOGRSoNZvAND69W/fDZQxyp5cyK4jW23MFgIQSfrwqw+Dd22bYp0GPdcwK/whV FZWmLPn0dspVPmi1AGBjggvyeARluhJDzZV2+G3MMUyHGPN3S7ST/eiPFBuRkjpOYzsJ 46sk6o59moTRMepia18po74t86ZtYsltdoPdrBWqCZnznqvY2cXACv4RALG/hK33h0ub HpwtWalVeiATLg8tRIuyK+NROwTVlRsg0POlziXxA4AKSLZW3R+qrteWls/ynEjdTAkQ iHZDdYs4n/Ld/MSm+XdbXjnMZrSL5Crbrk4otRD50fP7cjNf39tJ4FCEvsQe5ah55N/I Z5Vw== 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=lJCuKoIDILYUexMvAku2g1GbDEPQHml1GYYFBCJ8FzU=; b=hWFCqdV8JxVQtb0c3kXk5nP8ZAmiTBZcGTNL515r3h8w3fBgqVfwf6y5eofkC39mKF /0NnXw3KUabgtz2vbnV/kEo/U59n1oB/02V5pNoUoWZHfOY8AwyZhHDD4+8v3IwcLs85 MyFOrSIZ+ChRhICqImgmUul2ZteLx/9eSIOC6A3UV8jOWkPAip73dEROiP4MEo35UFV2 vX+q8Ff8KDIVgHFOypHGmnYbqbWWeR9xJMc0hlD8J1SCTsOeB3GVnCNL+9N9SEprvzga ydfyuHIFoAE522555QnyL5K/SXl/0LwSHpfJ7+oE1rjCuzWEg5WkTfEZxTopavqnY1T/ ZPjg==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61421-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCVLQsfK6Nv8F9FfdxQDoyIc8zB/2QnxyQ27Rq0WBg1HVDmwKQxVFla4qS96YzHn5yViv+dNBKNf/TZK6TXs4FMgKffLOA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f14-20020a170902ce8e00b001d8ffcee9d4si104089plg.536.2024.02.12.03.26.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 03:26:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61421-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61421-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 235382832FB for ; Mon, 12 Feb 2024 11:25:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A22739864; Mon, 12 Feb 2024 11:25:02 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790692257757997305 X-GMAIL-MSGID: 1790692257757997305 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);