diff options
author | Andrew Thoelke <andrew.thoelke@arm.com> | 2015-06-11 14:22:07 +0100 |
---|---|---|
committer | Andrew Thoelke <andrew.thoelke@arm.com> | 2015-06-19 11:26:16 +0100 |
commit | 9b89613eeb730b2813672098aa43ebd9cb94310c (patch) | |
tree | 9e383650e00b559afbb69a4df4191d3197cf51ad /services | |
parent | 79b1ebdaae021c0a9c4880849d181a5b91ecac8a (diff) |
Fix integer extension in mpidr_set_aff_inst()
mpidr_set_aff_inst() is left shifting an int constant and an
unsigned char value to construct an MPIDR. For affinity level 3 a
shift of 32 would result in shifting out of the 32-bit type and
have no effect on the MPIDR.
These values need to be extended to unsigned long before shifting
to ensure correct results for affinity level 3.
Change-Id: I1ef40afea535f14cfd820c347a065a228e8f4536
Diffstat (limited to 'services')
-rw-r--r-- | services/std_svc/psci/psci_common.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/services/std_svc/psci/psci_common.c b/services/std_svc/psci/psci_common.c index 237cf1e9..63d84760 100644 --- a/services/std_svc/psci/psci_common.c +++ b/services/std_svc/psci/psci_common.c @@ -185,8 +185,8 @@ unsigned long mpidr_set_aff_inst(unsigned long mpidr, aff_shift = get_afflvl_shift(aff_lvl); /* Clear the existing affinity instance & set the new one*/ - mpidr &= ~(MPIDR_AFFLVL_MASK << aff_shift); - mpidr |= aff_inst << aff_shift; + mpidr &= ~(((unsigned long)MPIDR_AFFLVL_MASK) << aff_shift); + mpidr |= ((unsigned long)aff_inst) << aff_shift; return mpidr; } |