When saddr_high != 0 on RV32, the goto out was unconditional, causing
valid 64-bit addresses to be rejected. Only goto out when the address
is invalid (64-bit host with saddr_high != 0).
Fixes: c2f41ddbcdd7 ("RISC-V: KVM: Implement SBI PMU Snapshot feature")
Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Andrew Jones <andrew.jones@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260311231833.13189-1-osama.abdelkader@gmail.com
Signed-off-by: Anup Patel <anup@brainfault.org>
saddr = saddr_low;
if (saddr_high != 0) {
- if (IS_ENABLED(CONFIG_32BIT))
+ if (IS_ENABLED(CONFIG_32BIT)) {
saddr |= ((gpa_t)saddr_high << 32);
- else
+ } else {
sbiret = SBI_ERR_INVALID_ADDRESS;
- goto out;
+ goto out;
+ }
}
kvpmu->sdata = kzalloc(snapshot_area_size, GFP_ATOMIC);