Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp3122715rdb; Tue, 13 Feb 2024 07:31:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWUpXh8iFA5brJ1yi3zxIZyDh+VnzPfxrVq8xw6+imVWG7c/MTNGO88gRXXtvWpZv/lXq4Zu2VzonSN40KqJZTUcUd8zNoVjc5k6uvAHA== X-Google-Smtp-Source: AGHT+IG3vE3fIyJyiMwveJSOZhqto4hbKvQZONOJtNUE6LulNQx/epiI0vjEgf1qYCPIfVVGNw06 X-Received: by 2002:a17:90a:4a8d:b0:297:2315:de0b with SMTP id f13-20020a17090a4a8d00b002972315de0bmr3944786pjh.11.1707838279721; Tue, 13 Feb 2024 07:31:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707838279; cv=pass; d=google.com; s=arc-20160816; b=FtINXg3WuMTXrfj9tyMGjBJ2BM2u9QNjULHaHrCb/tJNMAXlM+qoPaX7wZV+RaZ4Ki ZBFHX/3pvVW5uwwQkDOaJp/8d+NBO7QyupVYJ0d8uMYgJ1ObJlgqYCX6vbXy/f3ocnJX 4FaxzI1Y+Tg0eC+tiKR/cQl3m1XuyqkMkBY4wiqtrRSHXrei09CVzq5JIfzevfiT40kz fwJ9Y+IFGXd1cSdlhUv3d6SvoUuPau2x6qMxu4xNsHrJGJq6DmpM5oNH37kNM8+QawCT JGKcS1n/mcKXeQX7iR8YjKKOGzlwlBjiBcDQA8RIL76Scv6jrorGMfW2UniJkLop2xbJ 3fJQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=UXWVvtLoCB1QDiUpduxtiRyb7nwKtjJNicLJR9cKaY4=; fh=sktlIybgY7zwWkd6MrLNsbtZTnqy5uQyIZn98JDJGVk=; b=Tvj6pXbcZOzSgTPaQPJr0spa9i8koasqCUk2XkEkrR4kAS1yURhx0MMWh07MVFNwqQ X5TKdGQ/obQUiWjBbt2aKk5PC7vfchrs024VTi4zWr5RclKwoG3JRdd3SMJfOsU8BlA3 JRpRi0t8/rMjQB2SUdOD4SU8q9R/kV7iOjf9F8Kt45aiTq2RHHZLQ8zvumKrvVCCsfan /Iv3xIBsVmTaDWSx0gUPqQCMRTCLmgJSi32ADeX5qtxSucUr+Rw2LlO5YTZvLAW4s/Yw I51RNyJlz3FrtIwOA7GSS50TJWcbGOVUI4JFw6ZVGNp1sv2Rl4wW/1LUbxK+NdeRmMFk vkMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="XXT/JSwY"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63805-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63805-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; AJvYcCXltvncT8d+0czikBEUNU7Z3rCZd/PFb+d2QVbxDnoiJwiBtvp3WiyAHCN6qjiIVw2IW+XGahveVpuKqMfOS7v/35+wlI5baO/c98WxOg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id qe13-20020a17090b4f8d00b00296fcb6d8f8si2219535pjb.179.2024.02.13.07.31.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 07:31:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63805-linux.lists.archive=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="XXT/JSwY"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63805-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63805-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5CD4B282252 for ; Tue, 13 Feb 2024 15:31:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FE245EE62; Tue, 13 Feb 2024 15:31:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XXT/JSwY" 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 7621E224D5; Tue, 13 Feb 2024 15:31:12 +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=1707838272; cv=none; b=JY7J5W+NXM9DKY12JVyquq9lTQF+xD/JcelXHW8IQ1fB19OY2dbj3E18FjgrqKL4CIZ/Ne4uNOOw02abVi8QQbfH/jmT5+XipTpka5z5ZeaZQAXDNHcBCT0JBFOS64H8t7Pq912NE2O4t9WmQ/W9vvUk/jqzON/9Pjx79GYR0qM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707838272; c=relaxed/simple; bh=r/+C0SiRxWLKFJH5sGebudN07tjJgDQUZiy0Bx6875c=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=MOawDTV5eKZKKR4KLno3ephCE2Q37xaPZXojUVi5coODwLFpkiwhgUwvKGK3fvoz+0cJpDr+S7No2VyROpBNe8J4AVVs3xVn6o3sewvzVSeu+ZKDG059P6G7/aFhQQmOXwf9qH1ZqxaVkPCfR537V+uVEwcjLEnlhFyPTcPyetk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XXT/JSwY; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8A13C433F1; Tue, 13 Feb 2024 15:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707838271; bh=r/+C0SiRxWLKFJH5sGebudN07tjJgDQUZiy0Bx6875c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=XXT/JSwYKZ3WcbK3s9sTrDW7EzwbqPC3j5k1/P19GJe5rYm1UlsFlP7q7PfT2sgk9 x44CiQBeGeM8z/LR5lgm2lK33cMq/zPJV88BKL2lwc+j3FYx9YsWelMQRoPmOdPvGO nwO8nFeKAwyu9bKMbEDK+ZYqw5kDYcE+aWkthQn0ohHdmMtCGkNounNjgIhY2phC4l aHIO9K5p89pJcbSMDhjxooONnVgXdiO5BZt2YGP+/+Mn0l3kidZGXAUXmPvvWIZnvu UcAlxkRLTbDvgfimTQyQ/koaOXs2ZrMpjhnpSoOTni8c10sMC7zsdz/v/40kk9i68N KpDlgwyMvqfIg== Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-51181d8f52fso1347590e87.3; Tue, 13 Feb 2024 07:31:11 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXmh0Uuh8R9qYh6ShwJHuztoIJ4nQgdPtSjyzPsqpzsgjv88BuvfzPDbUsnZltD1IAEoH4IgYZlU4EBC8/YhH9kYzplgmFSd+eoNSNT7eYlkIbf4oHw6PM5uTH0MgqIAcHWib6Wchgw X-Gm-Message-State: AOJu0YycL2LWHKUhgKjzwy2TFFWvqD/K8osE1jU3q1gy8bpTABU3SPSQ IyKSYcLmtQBEfgcKJanlPxHluHDHNFX19yaT47uuacd6Xxf+1vrzUrGcqeB9Ycly8vQNTc+827X ANpNIsVhjAaRt4EEEU4o0DHZUCrA= X-Received: by 2002:a05:6512:3d11:b0:511:5237:a357 with SMTP id d17-20020a0565123d1100b005115237a357mr8197638lfv.48.1707838270132; Tue, 13 Feb 2024 07:31:10 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240212112454.1213449-1-arnd@kernel.org> In-Reply-To: <20240212112454.1213449-1-arnd@kernel.org> From: Ard Biesheuvel Date: Tue, 13 Feb 2024 16:30:58 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] efi/capsule-loader: fix incorrect allocation size To: Arnd Bergmann Cc: Ingo Molnar , Arnd Bergmann , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Mon, 12 Feb 2024 at 12:25, Arnd Bergmann wrote: > > 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); Thanks, queued as a fix.