diff mbox

ASoC: ak4613: Fix out of bounds array access for ak4613_iface

Message ID 20170609070121.30359-1-axel.lin@ingics.com (mailing list archive)
State Accepted
Commit b5f2a487f524e6eeeec38651e7b58760ebfd843e
Headers show

Commit Message

Axel Lin June 9, 2017, 7:01 a.m. UTC
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 sound/soc/codecs/ak4613.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kuninori Morimoto June 9, 2017, 8:58 a.m. UTC | #1
Hi

> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---

Wow !! indeed

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

>  sound/soc/codecs/ak4613.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c
> index e3121ca..c87ec49 100644
> --- a/sound/soc/codecs/ak4613.c
> +++ b/sound/soc/codecs/ak4613.c
> @@ -347,7 +347,7 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream,
>  		if (ak4613_dai_fmt_matching(priv->iface, is_play, fmt, width))
>  			iface = priv->iface;
>  	} else {
> -		for (i = ARRAY_SIZE(ak4613_iface); i >= 0; i--) {
> +		for (i = ARRAY_SIZE(ak4613_iface) - 1; i >= 0; i--) {
>  			if (!ak4613_dai_fmt_matching(ak4613_iface + i,
>  						     is_play,
>  						     fmt, width))
> -- 
> 2.9.3
>
diff mbox

Patch

diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c
index e3121ca..c87ec49 100644
--- a/sound/soc/codecs/ak4613.c
+++ b/sound/soc/codecs/ak4613.c
@@ -347,7 +347,7 @@  static int ak4613_dai_hw_params(struct snd_pcm_substream *substream,
 		if (ak4613_dai_fmt_matching(priv->iface, is_play, fmt, width))
 			iface = priv->iface;
 	} else {
-		for (i = ARRAY_SIZE(ak4613_iface); i >= 0; i--) {
+		for (i = ARRAY_SIZE(ak4613_iface) - 1; i >= 0; i--) {
 			if (!ak4613_dai_fmt_matching(ak4613_iface + i,
 						     is_play,
 						     fmt, width))