mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] platform/x86/amd/pmf: Do not use readl() for policy buffer access
@ 2024-02-27 14:04 Armin Wolf
  2024-02-27 14:05 ` [PATCH 2/2] platform/x86/amd/pmf: Fix possible out-of-bound memory accesses Armin Wolf
  2024-02-27 14:09 ` [PATCH 1/2] platform/x86/amd/pmf: Do not use readl() for policy buffer access Ilpo Järvinen
  0 siblings, 2 replies; 3+ messages in thread
From: Armin Wolf @ 2024-02-27 14:04 UTC (permalink / raw)
  To: Shyam-sundar.S-k
  Cc: hdegoede, ilpo.jarvinen, platform-driver-x86, linux-kernel

The policy buffer is allocated using normal memory allocation
functions, so readl() should not be used on it.

Compile-tested only.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 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 16973bebf55f..70d09103ab18 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 = dev->policy_buf[POLICY_COOKIE_OFFSET];
+	length = dev->policy_buf[POLICY_COOKIE_LEN];

 	if (cookie != POLICY_SIGN_COOKIE || !length)
 		return -EINVAL;
--
2.39.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-27 14:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27 14:04 [PATCH 1/2] platform/x86/amd/pmf: Do not use readl() for policy buffer access Armin Wolf
2024-02-27 14:05 ` [PATCH 2/2] platform/x86/amd/pmf: Fix possible out-of-bound memory accesses Armin Wolf
2024-02-27 14:09 ` [PATCH 1/2] platform/x86/amd/pmf: Do not use readl() for policy buffer access Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®