summaryrefslogtreecommitdiffstats
path: root/drivers/soundwire
diff options
context:
space:
mode:
authorSrinivas Kandagatla2019-05-22 18:24:43 +0200
committerVinod Koul2019-05-27 07:04:12 +0200
commit03ecad90d3798be11b033248bbd4bbff4425a1c7 (patch)
tree96a116c3d313bc0712e21f41c9f7d55f8bd630d1 /drivers/soundwire
parentLinux 5.2-rc1 (diff)
downloadkernel-qcow2-linux-03ecad90d3798be11b033248bbd4bbff4425a1c7.tar.gz
kernel-qcow2-linux-03ecad90d3798be11b033248bbd4bbff4425a1c7.tar.xz
kernel-qcow2-linux-03ecad90d3798be11b033248bbd4bbff4425a1c7.zip
soundwire: stream: fix out of boundary access on port properties
Assigning local iterator to array element and using it again for indexing would cross the array boundary. Fix this by directly referring array element without using the local variable. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/soundwire')
-rw-r--r--drivers/soundwire/stream.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index d01060dbee96..544925ff0b40 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -1406,9 +1406,7 @@ struct sdw_dpn_prop *sdw_get_slave_dpn_prop(struct sdw_slave *slave,
}
for (i = 0; i < num_ports; i++) {
- dpn_prop = &dpn_prop[i];
-
- if (dpn_prop->num == port_num)
+ if (dpn_prop[i].num == port_num)
return &dpn_prop[i];
}