mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <zhe.he@windriver.com>
To: <pmladek@suse.com>, <sergey.senozhatsky@gmail.com>,
	<rostedt@goodmis.org>, <linux-kernel@vger.kernel.org>,
	<zhe.he@windriver.com>
Subject: [PATCH] printk: Fix unnecessary returning broken pipe error from devkmsg_read
Date: Wed, 18 Sep 2019 21:31:43 +0800	[thread overview]
Message-ID: <1568813503-420025-1-git-send-email-zhe.he@windriver.com> (raw)

From: He Zhe <zhe.he@windriver.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@windriver.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


             reply	other threads:[~2019-09-18 13:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18 13:31 zhe.he [this message]
2019-09-23 10:05 ` Sergey Senozhatsky
2019-09-23 10:45   ` He Zhe
2019-09-23 11:39     ` Petr Mladek
2019-09-23 14:11       ` He Zhe
2019-09-23 19:58         ` John Ogness
2019-09-24  1:10     ` Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1568813503-420025-1-git-send-email-zhe.he@windriver.com \
    --to=zhe.he@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®