]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/powerpc: Fix out of bounds access in TM signal test
authorMichael Ellerman <mpe@ellerman.id.au>
Wed, 2 Mar 2016 12:28:54 +0000 (23:28 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 2 Mar 2016 12:34:45 +0000 (23:34 +1100)
commit708043f264f2ba84320c73b0cd045023f1e40a02
treef79f022804411c90145b96bd90c87def2b8fd63c
parent108624bd7705119ce6e2f60e0f3b6845b54a4ecd
selftests/powerpc: Fix out of bounds access in TM signal test

Gcc helpfully points out that we're accessing past the end of the gprs
array:

  tm-signal-msr-resv.c: In function 'signal_usr1':
  tm-signal-msr-resv.c:43:37: error: array subscript is above array bounds [-Werror=array-bounds]
    ucp->uc_mcontext.regs->gpr[PT_MSR] |= (7ULL);

We haven't noticed previously because -flto was hiding it somehow.

The code is confused, PT_MSR isn't a gpr, instead it's in
uc_regs->gregs, so fix it.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
tools/testing/selftests/powerpc/tm/tm-signal-msr-resv.c