]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
metag/usercopy: Set flags before ADDZ
authorJames Hogan <james.hogan@imgtec.com>
Tue, 4 Apr 2017 10:43:26 +0000 (11:43 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 21 Apr 2017 08:12:13 +0000 (10:12 +0200)
commite1ea981f4165199cee4036eee64ff652f0cedda3
tree4a9733800f714a8facbd0d8a2b056ba40ee432d8
parentea757d6ffda5cc42555fe9a9cf8bcfd79e092ca4
metag/usercopy: Set flags before ADDZ

BugLink: http://bugs.launchpad.net/bugs/1682130
commit fd40eee1290ad7add7aa665e3ce6b0f9fe9734b4 upstream.

The fixup code for the copy_to_user rapf loops reads TXStatus.LSM_STEP
to decide how far to rewind the source pointer. There is a special case
for the last execution of an MGETL/MGETD, since it leaves LSM_STEP=0
even though the number of MGETLs/MGETDs attempted was 4. This uses ADDZ
which is conditional upon the Z condition flag, but the AND instruction
which masked the TXStatus.LSM_STEP field didn't set the condition flags
based on the result.

Fix that now by using ANDS which does set the flags, and also marking
the condition codes as clobbered by the inline assembly.

Fixes: 373cd784d0fc ("metag: Memory handling")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
arch/metag/lib/usercopy.c