All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: Read buffer overflow
@ 2009-08-02 11:30 Roel Kluin
  2009-08-03  6:51 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-08-02 11:30 UTC (permalink / raw)
  To: tiwai, alsa-devel, Andrew Morton

Check whether index is within bounds before testing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
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;

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

* Re: [PATCH] ALSA: Read buffer overflow
  2009-08-02 11:30 [PATCH] ALSA: Read buffer overflow Roel Kluin
@ 2009-08-03  6:51 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2009-08-03  6:51 UTC (permalink / raw)
  To: Roel Kluin; +Cc: alsa-devel, Andrew Morton

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 <roel.kluin@gmail.com>

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;
> 

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

end of thread, other threads:[~2009-08-03  6:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-02 11:30 [PATCH] ALSA: Read buffer overflow Roel Kluin
2009-08-03  6:51 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.