RISC-V: hwprobe: Explicity check for -1 in vdso init
authorAndrew Jones <ajones@ventanamicro.com>
Wed, 26 Apr 2023 14:13:33 +0000 (16:13 +0200)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 26 Apr 2023 15:58:34 +0000 (08:58 -0700)
id_bitsmash is unsigned. We need to explicitly check for -1, rather
than use > 0.

Fixes: aa5af0aa90ba ("RISC-V: Add hwprobe vDSO function and data")
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Evan Green <evan@rivosinc.com>
Link: https://lore.kernel.org/r/20230426141333.10063-3-ajones@ventanamicro.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/sys_riscv.c

index c569dac7452eef32889001713697d9ebbf2269f2..5db29683ebee7a8cb8c115f221178c947cbbc230 100644 (file)
@@ -282,7 +282,7 @@ static int __init init_hwprobe_vdso_data(void)
         * populated) or any value returns -1 (varies across CPUs), then the
         * vDSO should defer to the kernel for exotic cpu masks.
         */
-       avd->homogeneous_cpus = (id_bitsmash > 0);
+       avd->homogeneous_cpus = id_bitsmash != 0 && id_bitsmash != -1;
        return 0;
 }