lkml.org 
[lkml]   [2019]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] soundwire: stream: fix out of boundary access on port properties
    Date
    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>
    ---
    drivers/soundwire/stream.c | 4 +---
    1 file changed, 1 insertion(+), 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];
    }

    --
    2.21.0
    \
     
     \ /
      Last update: 2019-05-22 18:25    [W:6.472 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site