Skip to content

Commit ed9244e

Browse files
Nicholas Mc Guireralfbaechle
authored andcommitted
MIPS: KVM: Do not sign extend on unsigned MMIO load
Fix possible unintended sign extension in unsigned MMIO loads by casting to uint16_t in the case of mmio_needed != 2. Signed-off-by: Nicholas Mc Guire <[email protected]> Reviewed-by: James Hogan <[email protected]> Tested-by: James Hogan <[email protected]> Cc: Gleb Natapov <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/9985/ Signed-off-by: Ralf Baechle <[email protected]>
1 parent 8833bc3 commit ed9244e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/mips/kvm/emulate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2409,7 +2409,7 @@ enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu,
24092409
if (vcpu->mmio_needed == 2)
24102410
*gpr = *(int16_t *) run->mmio.data;
24112411
else
2412-
*gpr = *(int16_t *) run->mmio.data;
2412+
*gpr = *(uint16_t *)run->mmio.data;
24132413

24142414
break;
24152415
case 1:

0 commit comments

Comments
 (0)