Skip to contentSkip to conversation

libxc/x86: correct overflow avoidance check in AMD CPUID handling

PATCH In review Jan Beulich 2 participants 2 messages Sep 25, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxc/x86: correct overflow avoidance check in AMD CPUID handling

Commit df29d03f1d ("libxc/x86: avoid certain overflows in CPUID APIC ID adjustments" introduced a one bit too narrow mask when checking whether multiplying by 1 (in particular in leaf 1) would result in overflow.

tools/libxc/xc_cpuid_x86.c +1 -1
@@ -403,7 +403,7 @@ static void amd_xc_cpuid_policy(const st
          * - incrementing ApicIdCoreSize when it's zero (which changes the
          *   meaning of bits 7:0).
          */
-        if ( (regs[2] & 0x7fu) < 0x7fu )
+        if ( (regs[2] & 0xffu) < 0x7fu )
         {
             if ( (regs[2] & 0xf000u) && (regs[2] & 0xf000u) != 0xf000u )
                 regs[2] = ((regs[2] + 0x1000u) & 0xf000u) | (regs[2] & 0xffu);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jan Beulich

Commit df29d03f1d ("libxc/x86: avoid certain overflows in CPUID APIC ID adjustments" introduced a one bit too narrow mask when checking whether multiplying by 1 (in particular in leaf 1) would result in overflow.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel