OSDN Git Service

powerpc/spufs: Fix coredump of SPU contexts
authorMichael Ellerman <mpe@ellerman.id.au>
Mon, 29 May 2017 10:26:07 +0000 (20:26 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:50:16 +0000 (19:50 +0200)
commitd43905a430e828afc132e61e1150d65b168b0562
tree6c2de5889e9006b1016c44daf3167ea023802098
parent89d648f65930f2ec6b0894974189f2cf51fc2624
powerpc/spufs: Fix coredump of SPU contexts

[ Upstream commit 99acc9bede06bbb2662aafff51f5b9e529fa845e ]

If a process dumps core while it has SPU contexts active then we have
code to also dump information about the SPU contexts.

Unfortunately it's been broken for 3 1/2 years, and we didn't notice. In
commit 7b1f4020d0d1 ("spufs: get rid of dump_emit() wrappers") the nread
variable was removed and rc used instead. That means when the loop exits
successfully, rc has the number of bytes read, but it's then used as the
return value for the function, which should return 0 on success.

So fix it by setting rc = 0 before returning in the success case.

Fixes: 7b1f4020d0d1 ("spufs: get rid of dump_emit() wrappers")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/platforms/cell/spufs/coredump.c