]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
X86: Don't assert on older Intel CPUs [BZ #20647]
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 12 Oct 2016 15:22:52 +0000 (08:22 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 12 Oct 2016 15:22:52 +0000 (08:22 -0700)
Since the maximum CPUID level of older Intel CPUs is 1, change
handle_intel to return -1, instead of assert, when the maximum
CPUID level is less than 2.

[BZ #20647]
* sysdeps/x86/cacheinfo.c (handle_intel): Return -1 if the
maximum CPUID level is less than 2.

ChangeLog
sysdeps/x86/cacheinfo.c

index d129219fd172cb1334d729bf43fd8a855e22e3da..81dd89ff27c420a1e1d4f7604b28f51cfdd2eccd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-10-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+       [BZ #20647]
+       * sysdeps/x86/cacheinfo.c (handle_intel): Return -1 if the
+       maximum CPUID level is less than 2.
+
 2016-10-12  Joseph Myers  <joseph@codesourcery.com>
 
        * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
index cf4f64b0d8e2a4ab7cc7a3d7c96e28b42c0dcb61..35268e8d9af98f30397e6e3bc37386f1c79e5635 100644 (file)
@@ -259,7 +259,9 @@ intel_check_word (int name, unsigned int value, bool *has_level_2,
 static long int __attribute__ ((noinline))
 handle_intel (int name, unsigned int maxidx)
 {
-  assert (maxidx >= 2);
+  /* Return -1 for older CPUs.  */
+  if (maxidx < 2)
+    return -1;
 
   /* OK, we can use the CPUID instruction to get all info about the
      caches.  */