summaryrefslogtreecommitdiff
path: root/sys/dev/sbus/cgthree.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/sbus/cgthree.c')
-rw-r--r--sys/dev/sbus/cgthree.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/dev/sbus/cgthree.c b/sys/dev/sbus/cgthree.c
index 781bc89ef52..a727217d455 100644
--- a/sys/dev/sbus/cgthree.c
+++ b/sys/dev/sbus/cgthree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgthree.c,v 1.20 2002/07/30 18:05:58 jason Exp $ */
+/* $OpenBSD: cgthree.c,v 1.21 2002/08/02 16:13:07 millert Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -543,7 +543,7 @@ cg3_bt_getcmap(bcm, rcm)
u_int index = rcm->index, count = rcm->count, i;
int error;
- if (index >= 256 || index + count > 256)
+ if (index >= 256 || count > 256 - index)
return (EINVAL);
for (i = 0; i < count; i++) {
if ((error = copyout(&bcm->cm_map[index + i][0],
@@ -567,8 +567,7 @@ cg3_bt_putcmap(bcm, rcm)
u_int index = rcm->index, count = rcm->count, i;
int error;
- if (index >= 256 || rcm->count > 256 ||
- (rcm->index + rcm->count) > 256)
+ if (index >= 256 || count > 256 - index)
return (EINVAL);
for (i = 0; i < count; i++) {
if ((error = copyin(&rcm->red[i],