summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm
diff options
context:
space:
mode:
authorVaibhav Jain <vaibhav@linux.vnet.ibm.com>2017-11-28 08:23:04 +0530
committerMichael Ellerman <mpe@ellerman.id.au>2017-11-29 19:36:13 +1100
commitaca7573fde95152378361cba734996b384f3b1d3 (patch)
tree813e55743e0a1914448ba8e91f005f5224a21bc8 /arch/powerpc/mm
parent2621e945fbf1d6df5f3f0ba7be5bae3d2cf9b6a5 (diff)
downloadop-kernel-dev-aca7573fde95152378361cba734996b384f3b1d3.zip
op-kernel-dev-aca7573fde95152378361cba734996b384f3b1d3.tar.gz
powerpc: Avoid signed to unsigned conversion in set_thread_tidr()
There is an unsafe signed to unsigned conversion in set_thread_tidr() that may cause an error value to be assigned to SPRN_TIDR register and used as thread-id. The issue happens as assign_thread_tidr() returns an int and thread.tidr is an unsigned-long. So a negative error code returned from assign_thread_tidr() will fail the error check and gets assigned as tidr as a large positive value. To fix this the patch assigns the return value of assign_thread_tidr() to a temporary int and assigns it to thread.tidr iff its '> 0'. The patch shouldn't impact the calling convention of set_thread_tidr() i.e all -ve return-values are error codes and a return value of '0' indicates success. Fixes: ec233ede4c86("powerpc: Add support for setting SPRN_TIDR") Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com> Reviewed-by: Christophe Lombard clombard@linux.vnet.ibm.com Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/mm')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud