lkml.org 
[lkml]   [2023]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 06/13] powerpc/pseries/nvram: Unpoison buffer populated by rtas_call
Date
rtas_call provides a buffer where the return data should be placed. Rtas
initializes the buffer which is not visible to KMSAN so unpoison it
manually.

Signed-off-by: Nicholas Miehlbradt <nicholas@linux.ibm.com>
---
arch/powerpc/platforms/pseries/nvram.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 8130c37962c0..21a27d459347 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -14,6 +14,7 @@
#include <linux/ctype.h>
#include <linux/uaccess.h>
#include <linux/of.h>
+#include <linux/kmsan-checks.h>
#include <asm/nvram.h>
#include <asm/rtas.h>
#include <asm/machdep.h>
@@ -41,6 +42,7 @@ static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index)
int done;
unsigned long flags;
char *p = buf;
+ size_t l;


if (nvram_size == 0 || nvram_fetch == RTAS_UNKNOWN_SERVICE)
@@ -53,6 +55,7 @@ static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index)
if (i + count > nvram_size)
count = nvram_size - i;

+ l = count;
spin_lock_irqsave(&nvram_lock, flags);

for (; count != 0; count -= len) {
@@ -73,6 +76,7 @@ static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index)
}

spin_unlock_irqrestore(&nvram_lock, flags);
+ kmsan_unpoison_memory(buf, l);

*index = i;
return p - buf;
--
2.40.1
\
 
 \ /
  Last update: 2023-12-14 06:58    [W:0.145 / U:1.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site