]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ASoC: qdsp6: q6asm-dai: Off by one in of_q6asm_parse_dai_data()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 21 Dec 2018 09:04:42 +0000 (12:04 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 3 Jan 2019 16:32:54 +0000 (16:32 +0000)
The q6asm_fe_dais[] array has MAX_SESSIONS (8) elements so the >
comparison should be >= or we access one element beyond the end of the
array.

Fixes: 22930c79ac5c ("ASoC: qdsp6: q6asm-dai: Add support to compress offload")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/qcom/qdsp6/q6asm-dai.c

index 5b986b74dd36f96d0a4a37bc8714f0b741c39486..9d738b4c1e05f106a400b771535e027bb259375f 100644 (file)
@@ -874,7 +874,7 @@ static int of_q6asm_parse_dai_data(struct device *dev,
 
        for_each_child_of_node(dev->of_node, node) {
                ret = of_property_read_u32(node, "reg", &id);
-               if (ret || id > MAX_SESSIONS || id < 0) {
+               if (ret || id >= MAX_SESSIONS || id < 0) {
                        dev_err(dev, "valid dai id not found:%d\n", ret);
                        continue;
                }