From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by befuddled.reisers.ca (Postfix, from userid 65534) id E19B31EFAE8; Sat, 2 Jan 2016 18:25:34 -0500 (EST) Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by befuddled.reisers.ca (Postfix) with ESMTPS id A4F841EFADD for ; Sat, 2 Jan 2016 18:25:33 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 90951200D1; Sun, 3 Jan 2016 00:25:31 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M0O_KGZWWqq0; Sun, 3 Jan 2016 00:25:31 +0100 (CET) Received: from var.youpi.perso.aquilenet.fr (ABordeaux-655-1-111-28.w92-134.abo.wanadoo.fr [92.134.98.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 23F97200CC; Sun, 3 Jan 2016 00:25:30 +0100 (CET) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.86) (envelope-from ) id 1aFVY9-0007iX-CD; Sun, 03 Jan 2016 00:25:29 +0100 Date: Sun, 3 Jan 2016 00:25:29 +0100 From: Samuel Thibault To: William Hubbs , Chris Brannon , Kirk Reiser , Greg Kroah-Hartman , speakup@linux-speakup.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] Staging: speakup: Fix getting port information Message-ID: <20160102232529.GC2860@var.home> Mail-Followup-To: Samuel Thibault , William Hubbs , Chris Brannon , Kirk Reiser , Greg Kroah-Hartman , speakup@linux-speakup.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 X-BeenThere: speakup@linux-speakup.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Speakup is a screen review system for Linux." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jan 2016 23:25:35 -0000 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 --- a/drivers/staging/speakup/serialio.c +++ b/drivers/staging/speakup/serialio.c @@ -6,6 +6,9 @@ #include "spk_priv.h" #include "serialio.h" +#include +#include + #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);