[PATCH] x86/AMD: check divisor in amd_parse_freq()

Jan Beulich posted 1 patch 1 day, 3 hours ago
[PATCH] x86/AMD: check divisor in amd_parse_freq()
Posted by Jan Beulich 1 day, 3 hours ago
While firmware ought to put sane values there, let's not risk failing to
boot because of flawed firmware.

Fixes: f6b6517cd5db ("x86: retrieve and log CPU frequency information")
Reported-by: Roger Pau Monné <roger.pau@amd.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -497,6 +497,8 @@ static unsigned int attr_const amd_parse
 		break;
 
 	case 0x17 ... 0x19:
+		if (!(value & 0x3fff))
+			break;
 		freq = ((value & 0xff) * 25 * 8) / ((value >> 8) & 0x3f);
 		break;