• Grant Likely's avatar
    of/selftest: Fix off-by-one error in removal path · c1a2086e
    Grant Likely authored
    The removal path for selftest data has an off by one error that causes
    the code to dereference beyond the end of the nodes[] array on the first
    pass through. The old code only worked by chance on a lot of platforms,
    but the bug was recently exposed on aarch64.
    
    The fix is simple. Decrement the node count before dereferencing, not
    after.
    Reported-by: default avatarKevin Hilman <khilman@linaro.org>
    Cc: Rob Herring <robh+dt@kernel.org>
    Cc: Gaurav Minocha <gaurav.minocha.os@gmail.com>
    Cc: <stable@vger.kernel.org> # v3.17+
    c1a2086e
selftest.c 28.4 KB