]> Git Repo - linux.git/commitdiff
ASoC: max9867: silence and array overflow warning
authorDan Carpenter <[email protected]>
Thu, 25 Feb 2016 07:50:38 +0000 (10:50 +0300)
committerMark Brown <[email protected]>
Fri, 26 Feb 2016 01:34:51 +0000 (10:34 +0900)
Smatch complains that we might reach the end of this loop without
finding what we're looking for leading to a buffer overflow.

Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
sound/soc/codecs/max9867.c

index f371a52fe29d6b9036d42cd45efa810ca953468e..2a22fddeb6afa02dbfb26b452cd4fd0f91b4024d 100755 (executable)
@@ -156,6 +156,8 @@ static inline int get_ni_value(int mclk, int rate)
                if (ni_div[i].mclk >= mclk)
                        break;
        }
+       if (i == ARRAY_SIZE(ni_div))
+               return -EINVAL;
 
        switch (rate) {
        case 8000:
This page took 0.055417 seconds and 4 git commands to generate.