From: Rusty Russell <rusty@rustcorp.com.au>
To: Ahmed Samy <f.fallen45@gmail.com>
Cc: ccan@lists.ozlabs.org
Subject: [PATCH] cpuid: increment over size of cpu array, not just first one.
Date: Fri, 04 Nov 2016 21:14:21 +1030 [thread overview]
Message-ID: <87fun7plru.fsf@rustcorp.com.au> (raw)
Found by PCS Suite.
Reported-by: Jon Griffiths
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/ccan/cpuid/cpuid.c b/ccan/cpuid/cpuid.c
index 9a42d83..4510def 100644
--- a/ccan/cpuid/cpuid.c
+++ b/ccan/cpuid/cpuid.c
@@ -237,7 +237,7 @@ cputype_t cpuid_get_cpu_type(void)
uint32_t i;
get_cpuid(CPUID_VENDORID, &i, &u.bufu32[0], &u.bufu32[2], &u.bufu32[1]);
- for (i = 0; i < sizeof(c_cpunames) / sizeof(c_cpunames); ++i) {
+ for (i = 0; i < sizeof(c_cpunames) / sizeof(c_cpunames[0]); ++i) {
if (strncmp(c_cpunames[i], u.buf, 12) == 0) {
cputype = (cputype_t)i;
break;
_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan
reply other threads:[~2016-11-04 10:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fun7plru.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=ccan@lists.ozlabs.org \
--cc=f.fallen45@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).