Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751096AbdFSFi4 (ORCPT ); Mon, 19 Jun 2017 01:38:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35094 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750848AbdFSFiz (ORCPT ); Mon, 19 Jun 2017 01:38:55 -0400 Date: Mon, 19 Jun 2017 13:38:28 +0800 From: Greg Kroah-Hartman To: Joe Perches Cc: Okash Khawaja , Jiri Slaby , Samuel Thibault , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, Kirk Reiser , speakup@linux-speakup.org, Chris Brannon Subject: Re: [patch v2 2/3] staging: speakup: check and convert dev name or ser to dev_t Message-ID: <20170619053828.GB25320@kroah.com> References: <20170618085825.601359240@gmail.com> <20170618093536.021961426@gmail.com> <20170619011533.GA11287@kroah.com> <1497850415.8495.39.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1497850415.8495.39.camel@perches.com> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1012 Lines: 28 On Sun, Jun 18, 2017 at 10:33:35PM -0700, Joe Perches wrote: > On Mon, 2017-06-19 at 09:15 +0800, Greg Kroah-Hartman wrote: > > On Sun, Jun 18, 2017 at 09:58:27AM +0100, Okash Khawaja wrote: > > > This patch adds functionality to validate and convert either a device > > > name or 'ser' member of synth into dev_t. > [] > > > --- a/drivers/staging/speakup/spk_ttyio.c > [] > > > +int ser_to_dev(int ser, dev_t *dev_no) > > > +{ > > > + if (ser < 0 || ser > (255 - 64)) { > > > + pr_err("speakup: Invalid ser param. \ > > > + Must be between 0 and 191 inclusive.\n"); > > > > As Andy pointed out, never do this for a C string, it's not doing what > > you think it is :) > > Well, some guy. > > > Worse case, do this like the following: > > pr_err("speakup: Invalid ser param." > > "Must be between 0 and 191 inclusive.\n"); > > Nope, now there's no space between param and Must. > > Using string concatenation on multiple lines is error prone. Ah, yes it is, see, I messed it up! :)