diff options
Diffstat (limited to 'arch/x86/kvm/lapic.c')
| -rw-r--r-- | arch/x86/kvm/lapic.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 991fdf7fc17f..9bf70cf84564 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
| @@ -138,6 +138,7 @@ static inline bool kvm_apic_map_get_logical_dest(struct kvm_apic_map *map, | |||
| 138 | if (offset <= max_apic_id) { | 138 | if (offset <= max_apic_id) { |
| 139 | u8 cluster_size = min(max_apic_id - offset + 1, 16U); | 139 | u8 cluster_size = min(max_apic_id - offset + 1, 16U); |
| 140 | 140 | ||
| 141 | offset = array_index_nospec(offset, map->max_apic_id + 1); | ||
| 141 | *cluster = &map->phys_map[offset]; | 142 | *cluster = &map->phys_map[offset]; |
| 142 | *mask = dest_id & (0xffff >> (16 - cluster_size)); | 143 | *mask = dest_id & (0xffff >> (16 - cluster_size)); |
| 143 | } else { | 144 | } else { |
| @@ -901,7 +902,8 @@ static inline bool kvm_apic_map_get_dest_lapic(struct kvm *kvm, | |||
| 901 | if (irq->dest_id > map->max_apic_id) { | 902 | if (irq->dest_id > map->max_apic_id) { |
| 902 | *bitmap = 0; | 903 | *bitmap = 0; |
| 903 | } else { | 904 | } else { |
| 904 | *dst = &map->phys_map[irq->dest_id]; | 905 | u32 dest_id = array_index_nospec(irq->dest_id, map->max_apic_id + 1); |
| 906 | *dst = &map->phys_map[dest_id]; | ||
| 905 | *bitmap = 1; | 907 | *bitmap = 1; |
| 906 | } | 908 | } |
| 907 | return true; | 909 | return true; |
