diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/cpu.c | 12 | ||||
-rw-r--r-- | sys/arch/i386/i386/cpu.c | 18 |
2 files changed, 19 insertions, 11 deletions
diff --git a/sys/arch/amd64/amd64/cpu.c b/sys/arch/amd64/amd64/cpu.c index 2089a1a5b7c..2f98f6c4888 100644 --- a/sys/arch/amd64/amd64/cpu.c +++ b/sys/arch/amd64/amd64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.39 2010/11/26 11:59:40 krw Exp $ */ +/* $OpenBSD: cpu.c,v 1.40 2010/11/27 13:03:04 kettenis Exp $ */ /* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */ /*- @@ -166,9 +166,13 @@ cpu_match(struct device *parent, void *match, void *aux) struct cfdata *cf = match; struct cpu_attach_args *caa = aux; - if (strcmp(caa->caa_name, cf->cf_driver->cd_name) == 0) - return 1; - return 0; + if (strcmp(caa->caa_name, cf->cf_driver->cd_name) != 0) + return 0; + + if (cf->cf_unit >= MAXCPUS) + return 0; + + return 1; } static void diff --git a/sys/arch/i386/i386/cpu.c b/sys/arch/i386/i386/cpu.c index 8a9898b08a8..c2d628e9a40 100644 --- a/sys/arch/i386/i386/cpu.c +++ b/sys/arch/i386/i386/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.41 2010/07/25 21:43:35 deraadt Exp $ */ +/* $OpenBSD: cpu.c,v 1.42 2010/11/27 13:03:04 kettenis Exp $ */ /* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */ /*- @@ -157,14 +157,18 @@ struct cfdriver cpu_cd = { }; int -cpu_match(struct device *parent, void *matchv, void *aux) +cpu_match(struct device *parent, void *match, void *aux) { - struct cfdata *match = (struct cfdata *)matchv; - struct cpu_attach_args *caa = (struct cpu_attach_args *)aux; + struct cfdata *cf = match; + struct cpu_attach_args *caa = aux; - if (strcmp(caa->caa_name, match->cf_driver->cd_name) == 0) - return (1); - return (0); + if (strcmp(caa->caa_name, cf->cf_driver->cd_name) != 0) + return 0; + + if (cf->cf_unit >= MAXCPUS) + return 0; + + return 1; } void |