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] [day] [month] [year] [list]
Date:   Sun, 06 Dec 2020 03:04:11 -0800
From:   Joe Perches <joe@...ches.com>
To:     Clement Smith <rclemsmith@...il.com>, gregkh@...uxfoundation.org
Cc:     linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/8] tty: serial: jsm: Fixed file by added more spacing

On Sun, 2020-12-06 at 13:09 +0530, Clement Smith wrote:
> Fixed a coding style issue

Don't send 8 identically titled patches that each change a single line.

Send one patch, with an updated title like:

	Subject: [PATCH] jsm_tty: Whitespace neatening

that changes _all_ the whitespace that you believe should be updated.

And ideally, instead of just whitespace changes, the code would be
updated to eliminate the code duplication by using temporaries and a
single line conversion.

> diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
[]
> @@ -607,7 +607,7 @@ void jsm_input(struct jsm_channel *ch)
>  				 * Give the Linux ld the flags in the
>  				 * format it likes.
>  				 */
> -				if (*(ch->ch_equeue +tail +i) & UART_LSR_BI)
> +				if (*(ch->ch_equeue + tail + i) & UART_LSR_BI)
>  					tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i),  TTY_BREAK);
>  				else if (*(ch->ch_equeue +tail +i) & UART_LSR_PE)
>  					tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_PARITY);

Something like:
---
 drivers/tty/serial/jsm/jsm_tty.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index 689774c073ca..b48ca17f38d3 100644
--- a/drivers/tty/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
@@ -607,14 +607,20 @@ void jsm_input(struct jsm_channel *ch)
 				 * Give the Linux ld the flags in the
 				 * format it likes.
 				 */
-				if (*(ch->ch_equeue +tail +i) & UART_LSR_BI)
-					tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i),  TTY_BREAK);
-				else if (*(ch->ch_equeue +tail +i) & UART_LSR_PE)
-					tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_PARITY);
-				else if (*(ch->ch_equeue +tail +i) & UART_LSR_FE)
-					tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_FRAME);
+				u8 error = ch->ch_equeue[tail + i];
+				u8 read = ch->ch_rqueue[tail + i];
+				int type;
+
+				if (error & UART_LSR_BI)
+					type = TTY_BREAK;
+				else if (error & UART_LSR_PE)
+					type = TTY_PARITY;
+				else if (error & UART_LSR_FE)
+					type = TTY_FRAME;
 				else
-					tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_NORMAL);
+					type = TTY_NORMAL;
+				tty_insert_flip_char(port, read, type);
+
 			}
 		} else {
 			tty_insert_flip_string(port, ch->ch_rqueue + tail, s);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ