From: Srinivas Kandagatla Date: Wed, 22 May 2019 16:24:43 +0000 (+0100) Subject: soundwire: stream: fix out of boundary access on port properties X-Git-Tag: v5.1.18~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=867abba5b0c6efc857ed5423c76792f49ca4d434;p=thirdparty%2Fkernel%2Fstable.git soundwire: stream: fix out of boundary access on port properties [ Upstream commit 03ecad90d3798be11b033248bbd4bbff4425a1c7 ] 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 Acked-by: Pierre-Louis Bossart Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index bd879b1a76c89..00618de2ee12f 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -1401,9 +1401,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]; }