Skip to content

Commit 70ad35d

Browse files
namhyungkees
authored andcommitted
pstore: Convert console write to use ->write_buf
Maybe I'm missing something, but I don't know why it needs to copy the input buffer to psinfo->buf and then write. Instead we can write the input buffer directly. The only implementation that supports console message (i.e. ramoops) already does it for ftrace messages. For the upcoming virtio backend driver, it needs to protect psinfo->buf overwritten from console messages. If it could use ->write_buf method instead of ->write, the problem will be solved easily. Cc: Stefan Hajnoczi <[email protected]> Signed-off-by: Namhyung Kim <[email protected]> Signed-off-by: Kees Cook <[email protected]>
1 parent e9e360b commit 70ad35d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/pstore/platform.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,8 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
585585
} else {
586586
spin_lock_irqsave(&psinfo->buf_lock, flags);
587587
}
588-
memcpy(psinfo->buf, s, c);
589-
psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, 0, c, psinfo);
588+
psinfo->write_buf(PSTORE_TYPE_CONSOLE, 0, &id, 0,
589+
s, 0, c, psinfo);
590590
spin_unlock_irqrestore(&psinfo->buf_lock, flags);
591591
s += c;
592592
c = e - s;

0 commit comments

Comments
 (0)