linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomas Mudrunka <tomas.mudrunka@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: tomas.mudrunka@gmail.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: [PATCH] /proc/sysrq-trigger: accept multiple keys at once
Date: Mon, 13 Nov 2023 19:22:19 +0100	[thread overview]
Message-ID: <20231113182227.698989-1-tomas.mudrunka@gmail.com> (raw)

Just for convenience.
This way we can do:
`echo reisub > /proc/sysrq-trigger`
Instead of:
`for i in r e i s u b; do echo "$i" > /proc/sysrq-trigger; done;`

Signed-off-by: Tomas Mudrunka <tomas.mudrunka@gmail.com>
---
 drivers/tty/sysrq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 6b4a28bcf..bc5a679f6 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -1154,10 +1154,12 @@ EXPORT_SYMBOL(unregister_sysrq_key);
 static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
 				   size_t count, loff_t *ppos)
 {
-	if (count) {
+	size_t i;
+
+	for (i = 0; i < count; i++) {
 		char c;
 
-		if (get_user(c, buf))
+		if (get_user(c, buf+i))
 			return -EFAULT;
 		__handle_sysrq(c, false);
 	}
-- 
2.42.1


             reply	other threads:[~2023-11-13 18:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-13 18:22 Tomas Mudrunka [this message]
2023-11-13 18:33 ` [PATCH] /proc/sysrq-trigger: accept multiple keys at once Greg Kroah-Hartman
2023-11-13 21:09   ` Tomáš Mudruňka
2023-11-13 21:37     ` Greg Kroah-Hartman
2023-11-14  9:35       ` [PATCH v2] " Tomas Mudrunka
2023-11-14  9:44         ` Jiri Slaby
2023-11-14  9:49           ` [PATCH v3] " Tomas Mudrunka
2023-11-14  9:50             ` Jiri Slaby
2023-11-14  9:55               ` [PATCH v4] " Tomas Mudrunka
2023-11-14 12:14                 ` Greg KH
2023-11-14 12:41                   ` [PATCH v5] " Tomas Mudrunka
2023-11-14 15:12                     ` [PATCH v6] " Tomas Mudrunka
2023-11-14 18:04                       ` Jiri Slaby
2023-11-14 22:00                         ` Randy Dunlap
2023-11-15 10:10                           ` Jiri Slaby
2023-11-15 10:27                             ` [PATCH v7] " Tomas Mudrunka
2023-11-15 10:29                             ` [PATCH v8] " Tomas Mudrunka
2023-11-15 10:34                             ` [PATCH v9] " Tomas Mudrunka
2023-11-20  7:45                               ` Jiri Slaby
2023-11-20 11:14                                 ` [PATCH v10] " Tomas Mudrunka
2023-11-20 11:32                                   ` Jiri Slaby

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=20231113182227.698989-1-tomas.mudrunka@gmail.com \
    --to=tomas.mudrunka@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).