summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/sparc/dev/bt_subr.c16
-rw-r--r--sys/arch/sparc/dev/cgfourteen.c22
-rw-r--r--sys/arch/sparc/dev/cgsix.c8
3 files changed, 43 insertions, 3 deletions
diff --git a/sys/arch/sparc/dev/bt_subr.c b/sys/arch/sparc/dev/bt_subr.c
index 11105ffa29d..5e96da0b624 100644
--- a/sys/arch/sparc/dev/bt_subr.c
+++ b/sys/arch/sparc/dev/bt_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bt_subr.c,v 1.3 1997/08/08 08:24:39 downsj Exp $ */
+/* $OpenBSD: bt_subr.c,v 1.4 1999/04/22 16:52:46 art Exp $ */
/* $NetBSD: bt_subr.c,v 1.5 1996/03/14 19:44:32 christos Exp $ */
/*
@@ -79,10 +79,17 @@ bt_getcmap(p, cm, cmsize)
count = p->count;
if (start >= cmsize || start + count > cmsize)
return (EINVAL);
+#if defined(UVM)
+ if (!uvm_useracc(p->red, count, B_WRITE) ||
+ !uvm_useracc(p->green, count, B_WRITE) ||
+ !uvm_useracc(p->blue, count, B_WRITE))
+ return (EFAULT);
+#else
if (!useracc(p->red, count, B_WRITE) ||
!useracc(p->green, count, B_WRITE) ||
!useracc(p->blue, count, B_WRITE))
return (EFAULT);
+#endif
for (cp = &cm->cm_map[start][0], i = 0; i < count; cp += 3, i++) {
p->red[i] = cp[0];
p->green[i] = cp[1];
@@ -107,10 +114,17 @@ bt_putcmap(p, cm, cmsize)
count = p->count;
if (start >= cmsize || start + count > cmsize)
return (EINVAL);
+#if defined(UVM)
+ if (!uvm_useracc(p->red, count, B_READ) ||
+ !uvm_useracc(p->green, count, B_READ) ||
+ !uvm_useracc(p->blue, count, B_READ))
+ return (EFAULT);
+#else
if (!useracc(p->red, count, B_READ) ||
!useracc(p->green, count, B_READ) ||
!useracc(p->blue, count, B_READ))
return (EFAULT);
+#endif
for (cp = &cm->cm_map[start][0], i = 0; i < count; cp += 3, i++) {
cp[0] = p->red[i];
cp[1] = p->green[i];
diff --git a/sys/arch/sparc/dev/cgfourteen.c b/sys/arch/sparc/dev/cgfourteen.c
index 052b245c11b..f8cd679af4f 100644
--- a/sys/arch/sparc/dev/cgfourteen.c
+++ b/sys/arch/sparc/dev/cgfourteen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgfourteen.c,v 1.2 1998/11/20 15:57:21 deraadt Exp $ */
+/* $OpenBSD: cgfourteen.c,v 1.3 1999/04/22 16:52:47 art Exp $ */
/* $NetBSD: cgfourteen.c,v 1.7 1997/05/24 20:16:08 pk Exp $ */
/*
@@ -483,9 +483,15 @@ cgfourteenioctl(dev, cmd, data, flags, p)
if ((u_int)p->size.x > 32 || (u_int)p->size.y > 32)
return (EINVAL);
count = p->size.y * 32 / NBBY;
+#if defined(UVM)
+ if (!uvm_useracc(p->image, count, B_READ) ||
+ !uvm_useracc(p->mask, count, B_READ))
+ return (EFAULT);
+#else
if (!useracc(p->image, count, B_READ) ||
!useracc(p->mask, count, B_READ))
return (EFAULT);
+#endif
}
/* parameters are OK; do it */
@@ -761,10 +767,17 @@ cg14_get_cmap(p, cm, cmsize)
}
#endif
+#if defined(UVM)
+ if (!uvm_useracc(p->red, count, B_WRITE) ||
+ !uvm_useracc(p->green, count, B_WRITE) ||
+ !uvm_useracc(p->blue, count, B_WRITE))
+ return (EFAULT);
+#else
if (!useracc(p->red, count, B_WRITE) ||
!useracc(p->green, count, B_WRITE) ||
!useracc(p->blue, count, B_WRITE))
return (EFAULT);
+#endif
for (cp = &cm->cm_map[start][0], i = 0; i < count; cp += 4, i++) {
p->red[i] = cp[3];
p->green[i] = cp[2];
@@ -796,10 +809,17 @@ cg14_put_cmap(p, cm, cmsize)
}
#endif
+#if defined(UVM)
+ if (!uvm_useracc(p->red, count, B_READ) ||
+ !uvm_useracc(p->green, count, B_READ) ||
+ !uvm_useracc(p->blue, count, B_READ))
+ return (EFAULT);
+#else
if (!useracc(p->red, count, B_READ) ||
!useracc(p->green, count, B_READ) ||
!useracc(p->blue, count, B_READ))
return (EFAULT);
+#endif
for (cp = &cm->cm_map[start][0], i = 0; i < count; cp += 4, i++) {
cp[3] = p->red[i];
cp[2] = p->green[i];
diff --git a/sys/arch/sparc/dev/cgsix.c b/sys/arch/sparc/dev/cgsix.c
index 5b272697289..6721d9c5761 100644
--- a/sys/arch/sparc/dev/cgsix.c
+++ b/sys/arch/sparc/dev/cgsix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgsix.c,v 1.10 1997/12/23 21:43:19 chuck Exp $ */
+/* $OpenBSD: cgsix.c,v 1.11 1999/04/22 16:52:47 art Exp $ */
/* $NetBSD: cgsix.c,v 1.33 1997/08/07 19:12:30 pk Exp $ */
/*
@@ -491,9 +491,15 @@ cgsixioctl(dev, cmd, data, flags, p)
if ((u_int)p->size.x > 32 || (u_int)p->size.y > 32)
return (EINVAL);
count = p->size.y * 32 / NBBY;
+#if defined(UVM)
+ if (!uvm_useracc(p->image, count, B_READ) ||
+ !uvm_useracc(p->mask, count, B_READ))
+ return (EFAULT);
+#else
if (!useracc(p->image, count, B_READ) ||
!useracc(p->mask, count, B_READ))
return (EFAULT);
+#endif
}
/* parameters are OK; do it */