[PATCH] powerpc/crash: Rearrange loop condition to avoid out of bounds array access

Andrew Donnellan andrew.donnellan at au1.ibm.com
Mon Jul 11 14:22:02 AEST 2016


On 11/07/16 14:17, Suraj Jitindar Singh wrote:
> The array crash_shutdown_handles[] has size CRASH_HANDLER_MAX, thus when
> we loop over the elements of the list we check crash_shutdown_handles[i]
> && i < CRASH_HANDLER_MAX. However this means that when we increment i to
> CRASH_HANDLER_MAX we will perform an out of bound array access checking
> the first condition before exiting on the second condition.
>
> To avoid the out of bounds access, simply reorder the loop conditions.
>
> Fixes Coverity bug #128232
>
> Signed-off-by: Suraj Jitindar Singh <sjitindarsingh at gmail.com>

Fixes: 1d1451655bad ("powerpc: Add array bounds checking to 
crash_shutdown_handlers")
Reviewed-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the Linuxppc-dev mailing list