From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] ALSA: Read buffer overflow Date: Mon, 03 Aug 2009 08:51:38 +0200 Message-ID: References: <4A7578E5.4070406@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id E1E85245FD for ; Mon, 3 Aug 2009 08:51:40 +0200 (CEST) In-Reply-To: <4A7578E5.4070406@gmail.com> 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: Roel Kluin Cc: alsa-devel@alsa-project.org, Andrew Morton List-Id: alsa-devel@alsa-project.org At Sun, 02 Aug 2009 13:30:45 +0200, Roel Kluin wrote: > > Check whether index is within bounds before testing the element. > > Signed-off-by: Roel Kluin Applied now. Thanks. Takashi > --- > diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c > index 8c8b273..45e0ee0 100644 > --- a/sound/pci/hda/patch_realtek.c > +++ b/sound/pci/hda/patch_realtek.c > @@ -559,7 +559,7 @@ static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, > > /* Find enumerated value for current pinctl setting */ > i = alc_pin_mode_min(dir); > - while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) > + while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) > i++; > *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); > return 0; >