Received: by 2002:ab2:5d18:0:b0:1ef:7a0f:c32d with SMTP id j24csp275610lqk; Sat, 9 Mar 2024 09:25:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUf5QJlkr7dTUppgwhKP2fv3ZQbArvFvWaBRhAlMXihQ44SHacdmtR4VrvdVTAUeEZg8jzDPjnZEr+29laJYI7Fum++kXNTDL/FPB6U1A== X-Google-Smtp-Source: AGHT+IH6WBXu+Vl+g+Ym7WJaxZ69CxLXFimLbjadu1koTz/LeS3zABUpBNoP8MsJDcMywJKr+c9X X-Received: by 2002:a17:906:4f0a:b0:a45:2e21:c9c3 with SMTP id t10-20020a1709064f0a00b00a452e21c9c3mr1204423eju.3.1710005115663; Sat, 09 Mar 2024 09:25:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1710005115; cv=pass; d=google.com; s=arc-20160816; b=QUS+GTlz9P8qe11BO8OThvPrbw9Xv/VHjpHsJrikxmRYAiTpY6BMcuii0W/whUsDtY vJdDLJ0+tPH1wsA+VpCCYTNM7N6TZk1FV70uqsXD0WbtOFsS/LyjuV3RcseaMAekm17d rf/U28XjeXVFbuMgcv5zSRUQrCn56YW8r1NeEKttTHb0judRpZ90yZezPK8ZHF3UB6MT +U/CsfnoZZf9oN9xcAvS2FbsnNSDgShvhFjKj81hyhSgwijg/YT58JF7oQjRZSSRgBA2 apXI7Tlw9e8BPUziGEyBVzvRwlWjPFyBDDj0QCaQXwIAMTw350KGh+4I9Edc5NCUpzKq Qyew== 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=twgFwiWdCdGqs18zIHruAf9EVb8e90jI3WiOBiux4bk=; fh=1hhOPKJyLr5HoFyKpvqnbata9ldK31MHCTd20W6Swc0=; b=iEuYU8Ly9uLgVIRjxxAkHrL0LnZ8fq1duH8dTkq83QWpoHfjxw8+5LlogB9KGY9yOv Ei7Z3ZHGacFan+KCNtAX2mYs059S9nqoCdNDo5wrSIrWqxNT1e01wLcLt/EIrKBzCyd7 y+/PcTAlt+QKHzXb3Om/IB36hZ1uO5VVlnmy7fxOmcWv9d1lvagMGcZNh3KcQlQhcOzZ vPM7mJVXsWXTiiQGgNjv5rUYTZa8jtV9xx6u34lpDBD2LKxL4iWP4vgvN4gou6dUUlVA fcqQrx8RYHv/xBEtjRYrlabk1qozCRhP/aCue0gCrX9o0dyJybKQul2ODWpRJjdKz7CC HZfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=fBqUOdLc; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-97966-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97966-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id oz34-20020a1709077da200b00a450e0732f0si969850ejc.678.2024.03.09.09.25.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 09:25:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97966-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=fBqUOdLc; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-97966-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97966-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr 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 62CA91F21BD7 for ; Sat, 9 Mar 2024 17:25:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F73F200A6; Sat, 9 Mar 2024 17:25:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="fBqUOdLc" Received: from smtp.smtpout.orange.fr (smtp-27.smtpout.orange.fr [80.12.242.27]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28CCC208CE for ; Sat, 9 Mar 2024 17:25:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.27 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710005108; cv=none; b=n2ZVwEiddVdXhQ06cx19sk8AVUC0j9v8rhF4gpeR0o0epfNvUiY4CYqqmAuckxRZEA1HTyeBpE9hGK2hqTX4wVXaYw4tAMH+nB3T7hedrFxwHCS5MFnY66Mgnkx+lupqruu58fIxJRTFSx2g5GXkbgVLGqvbgLnsaPIqqwRF6Do= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710005108; c=relaxed/simple; bh=ak74sgUl+aMNO+lsUKmolXguWnH/yTGMWgBb6ApRz8g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=kC6cL0nRIy/AYtcAeSrRtXQ2eIWCOJ7SuxUeOiubfXPyFo9MXxLlPo+nvOrn/R2WvjYRjoL2b1maxJg/dMayt6P1lQgJDjwh+xeh5AZSTguM4vpMKjs0Fo31QdrUltVcKEXyQfbUJjxiN8bwTFkpTwJVg7fIiLGjgRu1gzJD3tw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=fBqUOdLc; arc=none smtp.client-ip=80.12.242.27 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from fedora.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id j0Idrpm7o3j4bj0IdrdmP9; Sat, 09 Mar 2024 18:15:58 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1710004558; bh=twgFwiWdCdGqs18zIHruAf9EVb8e90jI3WiOBiux4bk=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=fBqUOdLc/4+MFbFoxiZPHXzi2P2f5lifzbjAygl1kUrlkFzffsFX/9Lu1vDnuIB2D KeUgqCxTTQDz1Y3CFVrbwL3qiRzR5iP2bnE0MyD01L2MMn76KmgxMzAlj7PPW4ySJG yo1uMbZoI1246YMwi4ORWmdHycakc8GYyIHNo2hs2PqjAWMFMjQAYWUPYhfAImmWh6 RbW8oiU7jGzyi0MLJtYV7yf0ySSZb56/FqcZ2gP1Ct0Aqy/Rhr2wFP7xR3wN+rSqQ0 kx08y9GgKyxXyMuj8SULQGXCsuh8kYlC942CTQRi0XumF03uL8aVtz9iNeYxqnusst IJwauTyteHjhQ== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 09 Mar 2024 18:15:58 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , kvm@vger.kernel.org Subject: [PATCH] KVM: SVM: Remove a useless zeroing of allocated memory Date: Sat, 9 Mar 2024 18:15:45 +0100 Message-ID: X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Depending of the memory size needed, we clear or not the allocated memory. This is not consistent. So remove the zeroing of the memory in the __vmalloc() case. Signed-off-by: Christophe JAILLET --- This is just a guess. I don't know this code at all, but because of KVM, it is maybe safer to clear the memory in both cases? So, maybe it is better to use kzalloc() in the other path. --- arch/x86/kvm/svm/sev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 722186601c03..afd9485bef5a 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -434,7 +434,7 @@ static struct page **sev_pin_memory(struct kvm *kvm, unsigned long uaddr, /* Avoid using vmalloc for smaller buffers. */ size = npages * sizeof(struct page *); if (size > PAGE_SIZE) - pages = __vmalloc(size, GFP_KERNEL_ACCOUNT | __GFP_ZERO); + pages = __vmalloc(size, GFP_KERNEL_ACCOUNT); else pages = kmalloc(size, GFP_KERNEL_ACCOUNT); -- 2.44.0