Skip to content

Commit c34bbc2

Browse files
bibo-maochenhuacai
authored andcommitted
LoongArch: KVM: Fix interrupt route update with EIOINTC
With function eiointc_update_sw_coremap(), there is forced assignment like val = *(u64 *)pvalue. Parameter pvalue may be pointer to char type or others, there is problem with forced assignment with u64 type. Here the detailed value is passed rather address pointer. Cc: [email protected] Fixes: 3956a52 ("LoongArch: KVM: Add EIOINTC read and write functions") Signed-off-by: Bibo Mao <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 9159c5e commit c34bbc2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

arch/loongarch/kvm/intc/eiointc.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ static void eiointc_update_irq(struct loongarch_eiointc *s, int irq, int level)
6666
}
6767

6868
static inline void eiointc_update_sw_coremap(struct loongarch_eiointc *s,
69-
int irq, void *pvalue, u32 len, bool notify)
69+
int irq, u64 val, u32 len, bool notify)
7070
{
7171
int i, cpu;
72-
u64 val = *(u64 *)pvalue;
7372

7473
for (i = 0; i < len; i++) {
7574
cpu = val & 0xff;
@@ -403,7 +402,7 @@ static int loongarch_eiointc_writeb(struct kvm_vcpu *vcpu,
403402
irq = offset - EIOINTC_COREMAP_START;
404403
index = irq;
405404
s->coremap.reg_u8[index] = data;
406-
eiointc_update_sw_coremap(s, irq, (void *)&data, sizeof(data), true);
405+
eiointc_update_sw_coremap(s, irq, data, sizeof(data), true);
407406
break;
408407
default:
409408
ret = -EINVAL;
@@ -488,7 +487,7 @@ static int loongarch_eiointc_writew(struct kvm_vcpu *vcpu,
488487
irq = offset - EIOINTC_COREMAP_START;
489488
index = irq >> 1;
490489
s->coremap.reg_u16[index] = data;
491-
eiointc_update_sw_coremap(s, irq, (void *)&data, sizeof(data), true);
490+
eiointc_update_sw_coremap(s, irq, data, sizeof(data), true);
492491
break;
493492
default:
494493
ret = -EINVAL;
@@ -573,7 +572,7 @@ static int loongarch_eiointc_writel(struct kvm_vcpu *vcpu,
573572
irq = offset - EIOINTC_COREMAP_START;
574573
index = irq >> 2;
575574
s->coremap.reg_u32[index] = data;
576-
eiointc_update_sw_coremap(s, irq, (void *)&data, sizeof(data), true);
575+
eiointc_update_sw_coremap(s, irq, data, sizeof(data), true);
577576
break;
578577
default:
579578
ret = -EINVAL;
@@ -658,7 +657,7 @@ static int loongarch_eiointc_writeq(struct kvm_vcpu *vcpu,
658657
irq = offset - EIOINTC_COREMAP_START;
659658
index = irq >> 3;
660659
s->coremap.reg_u64[index] = data;
661-
eiointc_update_sw_coremap(s, irq, (void *)&data, sizeof(data), true);
660+
eiointc_update_sw_coremap(s, irq, data, sizeof(data), true);
662661
break;
663662
default:
664663
ret = -EINVAL;
@@ -816,7 +815,7 @@ static int kvm_eiointc_ctrl_access(struct kvm_device *dev,
816815
for (i = 0; i < (EIOINTC_IRQS / 4); i++) {
817816
start_irq = i * 4;
818817
eiointc_update_sw_coremap(s, start_irq,
819-
(void *)&s->coremap.reg_u32[i], sizeof(u32), false);
818+
s->coremap.reg_u32[i], sizeof(u32), false);
820819
}
821820
break;
822821
default:

0 commit comments

Comments
 (0)