Thread (3 messages) flat view 3 messages, 3 authors, 2016-07-15

Re: powerpc/crash: Rearrange loop condition to avoid out of bounds array access

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-07-15 10:53:44

On Mon, 2016-11-07 at 04:17:31 UTC, 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.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Reviewed-by: Andrew Donnellan <redacted>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/a7d6392866e9777cb287ad194c

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help