Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Srinivas Kandagatla and committed by
Vinod Koul
03ecad90 a188339c

+1 -3
+1 -3
drivers/soundwire/stream.c
··· 1406 1406 } 1407 1407 1408 1408 for (i = 0; i < num_ports; i++) { 1409 - dpn_prop = &dpn_prop[i]; 1410 - 1411 - if (dpn_prop->num == port_num) 1409 + if (dpn_prop[i].num == port_num) 1412 1410 return &dpn_prop[i]; 1413 1411 } 1414 1412