Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2398874lqp; Sun, 24 Mar 2024 17:49:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV1Vo4lx3M8IW2x2fKLMsY9GlxQid3OdwZ90lsv4rKQJosF7vW4KhOrvtg/r1lwN8P857TdzoUbYFOlcM5wAmBWJz8oWPEntWHSzc/TLQ== X-Google-Smtp-Source: AGHT+IFy0vBwZz26ecg+Og+zyUJwA385jCdEiIOW4KaegslGYSGwreXGaU+9yXuY8U1D0JcHPC88 X-Received: by 2002:a05:6358:7f1c:b0:17e:b9f1:2e37 with SMTP id p28-20020a0563587f1c00b0017eb9f12e37mr6784314rwn.22.1711327748149; Sun, 24 Mar 2024 17:49:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711327748; cv=pass; d=google.com; s=arc-20160816; b=W49xsyMEwD/TH59URd1Z93a9z56pG2l+EW/zyK5LuXz5ltxzcE2dO7TQ0sTHZPbkbq lyxkbeE3hEdAj/F7vE00RdtNNoOVnSUwktyJyZewG7insJRhMIqb0pTSsnAVVdze9iih P2hY2iJif8hsbfnSYiPBoG8OcHXrFG8t9zs8Zj5/9vXEZAzw1HSNbTfGUzJk+VYXHFEG vJ2eVqxUxjaq7V8NkQNrPFfz5fhzw/7XVngId6C8vy5cGjoU0Wej/o/KzJ06waaMcQ6j vSI8fiWT2NVrNmvwfXuZgKeiBde5GhuPgR581MwrTpTrR6fHk0Vm+YL1qLy+FuZGDb0N vwFQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=QOnDatFGF1MuycyNsiK7i0V1yetq7bV1dJXdZudJlQM=; fh=GtyBzggf1QtSfP9bwkfZNPnYRW83o2uS4W49mi0SnXQ=; b=0KLt+7cq+hRBPn2BlWBhRVmT6F5bgpNfwJHPakBZhwu9Q/FczqUPFN6q8Z6jME4PPy ysPKXJ9Qkh/PJ/NLT+c/HEEyQQdj97CWHr2UdHntKAKIy+aYgZHilryl7nqdkfagNmfN bE+EomhBbiqq/vGZ/lXvHCI4geLbA+nAGQQNY9ESbDnQdDOYeBQCWS7XOpaWKVGu9EXW Sj1jiOewtA1YhSSwEsbOZOXeSyq+6StXtWGhSHFnF336WrbCzHyJ2HQ5xW6zAPTByp9Z sfp0zvolLIKfQc5g3rzLu02fjcqey73HZRDoJVFYchkYKEowxqr3F89d5YCYrg8qN8vg 3aOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ha3nSw0L; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113442-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113442-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e38-20020a635466000000b005d70bdd12f1si6460120pgm.189.2024.03.24.17.49.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:49:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113442-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=ha3nSw0L; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113442-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113442-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 E7062281D7C for ; Mon, 25 Mar 2024 00:37:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08E1E1ACFE5; Sun, 24 Mar 2024 22:44:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ha3nSw0L" 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 1C0411ACFC4; Sun, 24 Mar 2024 22:44:04 +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=1711320244; cv=none; b=oRBTp65E69wYshCjGOkrj/Sk6pJ/KE6/Q/ZohEtz2MY6tPLVuT7yHZcGLspP6UzeeyKwzSrJJCLCz850B1sL/okjoZhOcCN4UTDexRSSQ6bsgiy224HzhQ+za7N3qyduwabk0bny8h8nQdQTGqF3pwgki0UXFsi/IPsSGKJB+94= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320244; c=relaxed/simple; bh=5nBvLPvS85hnNcyAAtJrXNKzInCyyP9RkBGuH1IF9ig=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KUmwfmduI2+kKanIcM5I2LKV6NcW3UCiZYDKEZL3vm+vOntgAsdBSgL/w331cT5td0WigS1PMRgHRfblqOou02F8iAoxNZK7zL6dOoH1aOxk272vCajYFAREX7ODJxL9G3mSYZVfXcS1dWB/O918jH7KbnauLDJ0VCFhfoSGWAk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ha3nSw0L; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 459C6C433C7; Sun, 24 Mar 2024 22:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320244; bh=5nBvLPvS85hnNcyAAtJrXNKzInCyyP9RkBGuH1IF9ig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ha3nSw0LPyBkYhaZqO00HTux5rJOrPB0FxTd/iRgTW+Z/MxqqfkYNCBmm4WtGPXNX GT4v9eboyypMVCZ+Frlv1gsSJnQ/5+USAKtmV9Rx77SiwC/igeiufPqK4iCGvJhVmI PHJJ2Cc4sodnsuyn+T8bUVY8gbBu0P8iZMIxvVhmGMyAV87PREpTpsdkETn4pRYZXN 4KxD4/AA7ktVfBoDWGGLDCA2Of6R3NRqBA2vg2SHMXKnsNHI7pGq2vg0b5FYwvJN8d zkcgf6Vll4OVKC9j3vw1jEZgYXP2AciuKb7uy9dZ7mS1h3Oy4pO5wByh4nx+SohwA6 93+NnEcJn4/Ew== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Armin Wolf , Shyam Sundar S K , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 6.8 551/715] platform/x86/amd/pmf: Do not use readl() for policy buffer access Date: Sun, 24 Mar 2024 18:32:10 -0400 Message-ID: <20240324223455.1342824-552-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Armin Wolf [ Upstream commit e42dddce83a0578a518cb7078930c8269a6083af ] The policy buffer is allocated using normal memory allocation functions, so readl() should not be used on it. Compile-tested only. Fixes: 7c45534afa44 ("platform/x86/amd/pmf: Add support for PMF Policy Binary") Signed-off-by: Armin Wolf Reviewed-by: Shyam Sundar S K Link: https://lore.kernel.org/r/20240304205005.10078-3-W_Armin@gmx.de Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Sasha Levin --- drivers/platform/x86/amd/pmf/tee-if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c index dcbe8f85e1229..4ebfe0f5a7fb2 100644 --- a/drivers/platform/x86/amd/pmf/tee-if.c +++ b/drivers/platform/x86/amd/pmf/tee-if.c @@ -249,8 +249,8 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev) u32 cookie, length; int res; - cookie = readl(dev->policy_buf + POLICY_COOKIE_OFFSET); - length = readl(dev->policy_buf + POLICY_COOKIE_LEN); + cookie = *(u32 *)(dev->policy_buf + POLICY_COOKIE_OFFSET); + length = *(u32 *)(dev->policy_buf + POLICY_COOKIE_LEN); if (cookie != POLICY_SIGN_COOKIE || !length) { dev_dbg(dev->dev, "cookie doesn't match\n"); -- 2.43.0