summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2005-03-21 22:34:34 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2005-03-21 22:34:34 +0000
commit54b56a2ce8782c36eb760e6fa70c3bb2d2151a70 (patch)
treebd6b4d4e9f877691f407f515347fb4af452d4b19 /sys/arch
parentdd18df1abd03aa5e21ba90a2c5ebdd12f8f964cd (diff)
Do not print anything on console for can't happen situations unless option
DEBUG_SVR4.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc/sparc/svr4_machdep.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/sys/arch/sparc/sparc/svr4_machdep.c b/sys/arch/sparc/sparc/svr4_machdep.c
index 097b360ced5..188a1e3ae60 100644
--- a/sys/arch/sparc/sparc/svr4_machdep.c
+++ b/sys/arch/sparc/sparc/svr4_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svr4_machdep.c,v 1.12 2003/01/09 22:27:10 miod Exp $ */
+/* $OpenBSD: svr4_machdep.c,v 1.13 2005/03/21 22:34:33 miod Exp $ */
/* $NetBSD: svr4_machdep.c,v 1.24 1997/07/29 10:04:45 fair Exp $ */
/*
@@ -162,13 +162,13 @@ svr4_getcontext(p, uc, mask, oonstack)
size_t sz = f->fp_nqel * f->fp_nqsize;
if (sz > sizeof(fps->fs_queue)) {
#ifdef DIAGNOSTIC
- printf("getcontext: fp_queue too large\n");
+ printf("svr4_getcontext: fp_queue too large\n");
#endif
return;
}
if (copyout(fps->fs_queue, f->fp_q, sz) != 0) {
#ifdef DIAGNOSTIC
- printf("getcontext: copy of fp_queue failed %d\n",
+ printf("svr4_getcontext: copy of fp_queue failed %d\n",
error);
#endif
return;
@@ -254,7 +254,9 @@ svr4_setcontext(p, uc)
* that is required; if it holds, just do it.
*/
if (((r[SVR4_SPARC_PC] | r[SVR4_SPARC_nPC]) & 3) != 0) {
- printf("pc or npc are not multiples of 4!\n");
+#ifdef DEBUG_SVR4
+ printf("svr4_setcontext: pc or npc are not multiples of 4!\n");
+#endif
return EINVAL;
}
@@ -294,7 +296,7 @@ svr4_setcontext(p, uc)
size_t sz = f->fp_nqel * f->fp_nqsize;
if (sz > sizeof(fps->fs_queue)) {
#ifdef DIAGNOSTIC
- printf("setcontext: fp_queue too large\n");
+ printf("svr4_setcontext: fp_queue too large\n");
#endif
return EINVAL;
}
@@ -302,10 +304,16 @@ svr4_setcontext(p, uc)
fps->fs_qsize = f->fp_nqel;
fps->fs_fsr = f->fp_fsr;
if (f->fp_q != NULL) {
- if ((error = copyin(f->fp_q, fps->fs_queue,
- f->fp_nqel * f->fp_nqsize)) != 0) {
+ size_t sz = f->fp_nqel * f->fp_nqsize;
+ if (sz > sizeof(fps->fs_queue)) {
+#ifdef DIAGNOSTIC
+ printf("svr4_setcontext: fp_queue too large\n");
+#endif
+ return (EINVAL);
+ }
+ if ((error = copyin(f->fp_q, fps->fs_queue, sz)) != 0) {
#ifdef DIAGNOSTIC
- printf("setcontext: copy of fp_queue failed\n");
+ printf("svr4_setcontext: copy of fp_queue failed\n");
#endif
return error;
}