From 263c2eb8bd2b9c6c946a3768918fda98e8dfe1f2 Mon Sep 17 00:00:00 2001 From: Niels Boehm Date: Sun, 14 Oct 2018 12:50:33 +0200 Subject: [PATCH] Fix return value from RdSeed_cpuid() The function returned `info[1]` (which is the content of the `ebx` register) instead of `0` when it detected that _rdseed_ is unavailable. This is likely a remnant from an earlier iteration of the code. While it is unlikely that it will show up as bug (all of the bits of `ebx` would have to be cleared, except bit #0 which would have to be set) due to the calling function comparing the return value explicitly with 1, it's still better to fix it. --- rdrand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdrand.c b/rdrand.c index 464b10e..2c2f048 100644 --- a/rdrand.c +++ b/rdrand.c @@ -162,7 +162,7 @@ RdSeed_cpuid(void) if ((ebx & RDSEED_MASK) == RDSEED_MASK) return 1; else - return info[1]; + return 0; } /************************