From mboxrd@z Thu Jan 1 00:00:00 1970 From: Clemens Ladisch Subject: Re: [patch v2] ALSA: rawmidi: fix the get next midi device ioctl Date: Thu, 09 Sep 2010 09:44:52 +0200 Message-ID: <4C889074.6060901@ladisch.de> References: <20100908193641.GA3463@bicker> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by alsa0.perex.cz (Postfix) with ESMTP id A179824552 for ; Thu, 9 Sep 2010 09:44:32 +0200 (CEST) In-Reply-To: <20100908193641.GA3463@bicker> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Dan Carpenter Cc: alsa-devel@alsa-project.org, Takashi Iwai , kernel-janitors@vger.kernel.org, Kyle McMartin , Ulrich Drepper List-Id: alsa-devel@alsa-project.org Dan Carpenter wrote: > If we pass in a device which is higher than SNDRV_RAWMIDI_DEVICES then > this function just returns device + 1 which isn't helpful. I've > modified it to return -EINVAL instead. > > Also Smatch complains because the "device + 1" could be an integer > overflow. It's harmless, It would result in device==INT_MIN, which would make the while loop go through 2^31 values before finding the first MIDI device. Regards, Clemens