+ tty_ioctl-fix-the-baud_table-check-in-encode_baud_rate.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     tty_ioctl: fix the baud_table check in encode_baud_rate
has been added to the -mm tree.  Its filename is
     tty_ioctl-fix-the-baud_table-check-in-encode_baud_rate.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: tty_ioctl: fix the baud_table check in encode_baud_rate
From: "Maciej W. Rozycki" <macro@xxxxxxxxxxxxxx>

The tty_termios_encode_baud_rate() function as defined by tty_ioctl.c has a
problem with the baud_table within.  The comparison operators are reversed
and as a result this table's entries never match and BOTHER is always used.

Signed-off-by: Maciej W. Rozycki <macro@xxxxxxxxxxxxxx>
Acked-by: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/char/tty_ioctl.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff -puN drivers/char/tty_ioctl.c~tty_ioctl-fix-the-baud_table-check-in-encode_baud_rate drivers/char/tty_ioctl.c
--- a/drivers/char/tty_ioctl.c~tty_ioctl-fix-the-baud_table-check-in-encode_baud_rate
+++ a/drivers/char/tty_ioctl.c
@@ -228,7 +228,8 @@ EXPORT_SYMBOL(tty_termios_input_baud_rat
  *	and will all go away once this is done.
  */
 
-void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud)
+void tty_termios_encode_baud_rate(struct ktermios *termios,
+				  speed_t ibaud, speed_t obaud)
 {
 	int i = 0;
 	int ifound = -1, ofound = -1;
@@ -263,11 +264,15 @@ void tty_termios_encode_baud_rate(struct
 	 */
 
 	do {
-		if (obaud - oclose >= baud_table[i] && obaud + oclose <= baud_table[i]) {
+		if (obaud - oclose <= baud_table[i] &&
+		    obaud + oclose >= baud_table[i]) {
 			termios->c_cflag |= baud_bits[i];
 			ofound = i;
 		}
-		if (ibaud - iclose >= baud_table[i] && ibaud + iclose <= baud_table[i]) {
+		if (ibaud - iclose <= baud_table[i] &&
+		    ibaud + iclose >= baud_table[i]) {
+			/* For the case input == output don't set IBAUD bits
+			   if the user didn't do so */
 			if (ofound == i && !ibinput)
 				ifound  = i;
 #ifdef IBSHIFT
_

Patches currently in -mm which might be from macro@xxxxxxxxxxxxxx are

origin.patch
include-linux-typesh-in-if_fddih.patch
avoid-negative-and-full-width-shifts-in-radix-treec.patch
lk201-remove-obsolete-driver.patch
tty_ioctl-fix-the-baud_table-check-in-encode_baud_rate.patch
kernel-printkc-concerns-about-the-console-handover.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux