linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Staging: speakup: Fix getting port information
@ 2016-01-02 23:25 Samuel Thibault
  2016-01-02 23:49 ` Samuel Thibault
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Samuel Thibault @ 2016-01-02 23:25 UTC (permalink / raw)
  To: William Hubbs, Chris Brannon, Kirk Reiser, Greg Kroah-Hartman,
	speakup, devel, linux-kernel

5e6dc54 broke the port information in the speakup driver:
SERIAL_PORT_DFNS only gets defined if asm/serial.h is included.

Along the way, make sure that we do have information for the requested
serial port number (index)

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -6,6 +6,9 @@
 #include "spk_priv.h"
 #include "serialio.h"
 
+#include <linux/serial_core.h>
+#include <asm/serial.h>
+
 #ifndef SERIAL_PORT_DFNS
 #define SERIAL_PORT_DFNS
 #endif
@@ -26,6 +29,11 @@ const struct old_serial_port *spk_serial
 	const struct old_serial_port *ser = rs_table + index;
 	int err;
 
+	if (index > sizeof(rs_table) / sizeof(*rs_table)) {
+		pr_info("no port info for ttyS%d\n", index);
+		return NULL;
+	}
+
 	/*	Divisor, bytesize and parity */
 	quot = ser->baud_base / baud;
 	cval = cflag & (CSIZE | CSTOPB);

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [PATCH] Staging: speakup: Fix getting port information
@ 2016-01-05  1:19 Samuel Thibault
  2016-01-05  9:36 ` Dan Carpenter
  0 siblings, 1 reply; 15+ messages in thread
From: Samuel Thibault @ 2016-01-05  1:19 UTC (permalink / raw)
  To: William Hubbs, Chris Brannon, Kirk Reiser, Melike Yurtoglu,
	Greg Kroah-Hartman, speakup, devel, linux-kernel

Patch f79b0d9c223c ("staging: speakup: Fixed warning <linux/serial.h>
instead of <asm/serial.h>") broke the port information in the speakup
driver: SERIAL_PORT_DFNS only gets defined if asm/serial.h is included,
and no other header includes asm/serial.h.

We here make sure serialio.c does get the arch-specific definition of
SERIAL_PORT_DFNS from asm/serial.h, if any.

Along the way, this makes sure that we do have information for the
requested serial port number (index)

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Fixes: f79b0d9c223c ("staging: speakup: Fixed warning <linux/serial.h> instead of <asm/serial.h>")

--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -6,6 +6,9 @@
 #include "spk_priv.h"
 #include "serialio.h"
 
+#include <linux/serial_core.h>
+#include <asm/serial.h>
+
 #ifndef SERIAL_PORT_DFNS
 #define SERIAL_PORT_DFNS
 #endif
@@ -23,9 +26,15 @@ const struct old_serial_port *spk_serial
 	int baud = 9600, quot = 0;
 	unsigned int cval = 0;
 	int cflag = CREAD | HUPCL | CLOCAL | B9600 | CS8;
-	const struct old_serial_port *ser = rs_table + index;
+	const struct old_serial_port *ser;
 	int err;
 
+	if (index >= ARRAY_SIZE(rs_table)) {
+		pr_info("no port info for ttyS%d\n", index);
+		return NULL;
+	}
+	ser = rs_table + index;
+
 	/*	Divisor, bytesize and parity */
 	quot = ser->baud_base / baud;
 	cval = cflag & (CSIZE | CSTOPB);

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [PATCH] Staging: speakup: Fix getting port information
@ 2016-01-14 23:47 Samuel Thibault
  2016-01-15  5:59 ` Dan Carpenter
  2016-01-25  0:29 ` Samuel Thibault
  0 siblings, 2 replies; 15+ messages in thread
From: Samuel Thibault @ 2016-01-14 23:47 UTC (permalink / raw)
  To: Dan Carpenter, William Hubbs, Chris Brannon, Kirk Reiser,
	Melike Yurtoglu, Greg Kroah-Hartman
  Cc: speakup, devel, linux-kernel

Commit f79b0d9c223c ("staging: speakup: Fixed warning <linux/serial.h>
instead of <asm/serial.h>") broke the port information in the speakup
driver: SERIAL_PORT_DFNS only gets defined if asm/serial.h is included,
and no other header includes asm/serial.h.

We here make sure serialio.c does get the arch-specific definition of
SERIAL_PORT_DFNS from asm/serial.h, if any.

Along the way, this makes sure that we do have information for the
requested serial port number (index)

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Fixes: f79b0d9c223c ("staging: speakup: Fixed warning <linux/serial.h> instead of <asm/serial.h>")

--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -6,6 +6,11 @@
 #include "spk_priv.h"
 #include "serialio.h"
 
+#include <linux/serial_core.h>
+/* WARNING:  Do not change this to <linux/serial.h> without testing that
+ * SERIAL_PORT_DFNS does get defined to the appropriate value. */
+#include <asm/serial.h>
+
 #ifndef SERIAL_PORT_DFNS
 #define SERIAL_PORT_DFNS
 #endif
@@ -23,9 +28,15 @@ const struct old_serial_port *spk_serial
 	int baud = 9600, quot = 0;
 	unsigned int cval = 0;
 	int cflag = CREAD | HUPCL | CLOCAL | B9600 | CS8;
-	const struct old_serial_port *ser = rs_table + index;
+	const struct old_serial_port *ser;
 	int err;
 
+	if (index >= ARRAY_SIZE(rs_table)) {
+		pr_info("no port info for ttyS%d\n", index);
+		return NULL;
+	}
+	ser = rs_table + index;
+
 	/*	Divisor, bytesize and parity */
 	quot = ser->baud_base / baud;
 	cval = cflag & (CSIZE | CSTOPB);

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-01-25  2:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-02 23:25 [PATCH] Staging: speakup: Fix getting port information Samuel Thibault
2016-01-02 23:49 ` Samuel Thibault
2016-01-03  0:10 ` covici
2016-01-03  0:56   ` Samuel Thibault
2016-01-03  1:31     ` covici
2016-01-04 12:22     ` Dan Carpenter
2016-01-04 12:26       ` Dan Carpenter
2016-01-04 12:20 ` Dan Carpenter
2016-01-05  1:14   ` Samuel Thibault
  -- strict thread matches above, loose matches on Subject: below --
2016-01-05  1:19 Samuel Thibault
2016-01-05  9:36 ` Dan Carpenter
2016-01-14 23:47 Samuel Thibault
2016-01-15  5:59 ` Dan Carpenter
2016-01-25  0:29 ` Samuel Thibault
2016-01-25  2:52   ` Greg Kroah-Hartman

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).