Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1334236 > unrolled thread

[PATCHv2 2/2] fs/pstore: Use memcpy_fromio() to save old ramoops buffer

Started byEnric Balletbo i Serra <enric.balletbo@collabora.com>
First post2016-02-15 09:30 +0100
Last post2016-02-15 09:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCHv2 2/2] fs/pstore: Use memcpy_fromio() to save old ramoops buffer Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2016-02-15 09:30 +0100

#1334236 — [PATCHv2 2/2] fs/pstore: Use memcpy_fromio() to save old ramoops buffer

FromEnric Balletbo i Serra <enric.balletbo@collabora.com>
Date2016-02-15 09:30 +0100
Subject[PATCHv2 2/2] fs/pstore: Use memcpy_fromio() to save old ramoops buffer
Message-ID<r2mHF-6N6-17@gated-at.bofh.it>
From: Andrew Bresticker <abrestic@chromium.org>

The ramoops buffer may be mapped as either I/O memory or uncached
memory.  On ARM64, this results in a device-type (strongly-ordered)
mapping.  Since unnaligned accesses to device-type memory will
generate an alignment fault (regardless of whether or not strict
alignment checking is enabled), it is not safe to use memcpy().
memcpy_fromio() is guaranteed to only use aligned accesses, so use
that instead.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Signed-off-by: Enric Balletbo Serra <enric.balletbo@collabora.com>
Reviewed-by: Puneet Kumar <puneetster@chromium.org>
Acked-by: Kees Cook <keescook@chromium.org>
---
 fs/pstore/ram_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index 351164d..5308277 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -322,8 +322,8 @@ void persistent_ram_save_old(struct persistent_ram_zone *prz)
 	}
 
 	prz->old_log_size = size;
-	memcpy(prz->old_log, &buffer->data[start], size - start);
-	memcpy(prz->old_log + size - start, &buffer->data[0], start);
+	memcpy_fromio(prz->old_log, &buffer->data[start], size - start);
+	memcpy_fromio(prz->old_log + size - start, &buffer->data[0], start);
 }
 
 int notrace persistent_ram_write(struct persistent_ram_zone *prz,
-- 
2.1.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web