]> git.ipfire.org Git - people/arne_f/kernel.git/commit
powerpc/ptrace: Fix out of bounds array access warning
authorKhem Raj <raj.khem@gmail.com>
Fri, 2 Mar 2018 04:45:48 +0000 (15:45 +1100)
committerSasha Levin <alexander.levin@microsoft.com>
Sun, 4 Mar 2018 15:28:35 +0000 (10:28 -0500)
commitf1d035422a54914c03aebda611ad3f6b3ecf0636
tree9ef7528571855c7c4f00062b1a3bb29028396333
parentfe4de7adb52d72747dd05dd6b2309d7aa6678399
powerpc/ptrace: Fix out of bounds array access warning

commit 1e407ee3b21f981140491d5b8a36422979ca246f upstream.

gcc-6 correctly warns about a out of bounds access

arch/powerpc/kernel/ptrace.c:407:24: warning: index 32 denotes an offset greater than size of 'u64[32][1] {aka long long unsigned int[32][1]}' [-Warray-bounds]
        offsetof(struct thread_fp_state, fpr[32][0]));
                        ^

check the end of array instead of beginning of next element to fix this

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
arch/powerpc/kernel/ptrace.c