lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210618061516.662-32-jslaby@suse.cz>
Date:   Fri, 18 Jun 2021 08:14:37 +0200
From:   Jiri Slaby <jslaby@...e.cz>
To:     gregkh@...uxfoundation.org
Cc:     linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH 31/70] mxser: remove cnt from mxser_receive_chars

After the previous ioctls removal, cnt is needed only in
mxser_receive_chars_old now. So remove it from mxser_receive_chars and
mxser_receive_chars_new and account only in mxser_receive_chars_old.

Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
 drivers/tty/mxser.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 586fa3575673..d354c80083fd 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -1743,7 +1743,7 @@ static int mxser_rs_break(struct tty_struct *tty, int break_state)
 }
 
 static bool mxser_receive_chars_new(struct tty_struct *tty,
-		struct mxser_port *port, u8 status, int *cnt)
+		struct mxser_port *port, u8 status)
 {
 	enum mxser_must_hwid hwid = port->board->must_hwid;
 	u8 gdl;
@@ -1767,19 +1767,19 @@ static bool mxser_receive_chars_new(struct tty_struct *tty,
 	while (gdl--) {
 		u8 ch = inb(port->ioaddr + UART_RX);
 		tty_insert_flip_char(&port->port, ch, 0);
-		(*cnt)++;
 	}
 
 	return true;
 }
 
 static u8 mxser_receive_chars_old(struct tty_struct *tty,
-		                struct mxser_port *port, u8 status, int *cnt)
+		                struct mxser_port *port, u8 status)
 {
 	enum mxser_must_hwid hwid = port->board->must_hwid;
 	int recv_room = tty->receive_room;
 	int ignored = 0;
 	int max = 256;
+	int cnt = 0;
 	u8 ch;
 
 	do {
@@ -1814,8 +1814,8 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty,
 				}
 			}
 			tty_insert_flip_char(&port->port, ch, flag);
-			(*cnt)++;
-			if (*cnt >= recv_room) {
+			cnt++;
+			if (cnt >= recv_room) {
 				if (!port->ldisc_stop_rx)
 					mxser_stoprx(tty);
 				break;
@@ -1835,13 +1835,11 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty,
 static u8 mxser_receive_chars(struct tty_struct *tty,
 		struct mxser_port *port, u8 status)
 {
-	int cnt = 0;
-
 	if (tty->receive_room == 0 && !port->ldisc_stop_rx)
 		mxser_stoprx(tty);
 
-	if (!mxser_receive_chars_new(tty, port, status, &cnt))
-		status = mxser_receive_chars_old(tty, port, status, &cnt);
+	if (!mxser_receive_chars_new(tty, port, status))
+		status = mxser_receive_chars_old(tty, port, status);
 
 	tty_flip_buffer_push(&port->port);
 
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ