[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1568813503-420025-1-git-send-email-zhe.he@windriver.com>
Date: Wed, 18 Sep 2019 21:31:43 +0800
From: <zhe.he@...driver.com>
To: <pmladek@...e.com>, <sergey.senozhatsky@...il.com>,
<rostedt@...dmis.org>, <linux-kernel@...r.kernel.org>,
<zhe.he@...driver.com>
Subject: [PATCH] printk: Fix unnecessary returning broken pipe error from devkmsg_read
From: He Zhe <zhe.he@...driver.com>
When users read the buffer from start, there is no need to return -EPIPE
since the possible overflows will not affect the output.
Signed-off-by: He Zhe <zhe.he@...driver.com>
---
kernel/printk/printk.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 1888f6a..4a6a129 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -886,7 +886,9 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
logbuf_lock_irq();
}
- if (user->seq < log_first_seq) {
+ if (user->seq == 0) {
+ user->seq = log_first_seq;
+ } else if (user->seq < log_first_seq) {
/* our last seen message is gone, return error and reset */
user->idx = log_first_idx;
user->seq = log_first_seq;
--
2.7.4
Powered by blists - more mailing lists