ALSA: hda - Read buffer overflow

Check whether index is within bounds before testing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by Roel Kluin and committed by Takashi Iwai 4b35d2ca 84d3dc20

+1 -1
+1 -1
sound/pci/hda/patch_realtek.c
··· 559 559 560 560 /* Find enumerated value for current pinctl setting */ 561 561 i = alc_pin_mode_min(dir); 562 - while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) 562 + while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) 563 563 i++; 564 564 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); 565 565 return 0;