summaryrefslogtreecommitdiff
path: root/sys/arch/amiga/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/amiga/dev')
-rw-r--r--sys/arch/amiga/dev/grf_cl.c6
-rw-r--r--sys/arch/amiga/dev/grf_cv.c6
-rw-r--r--sys/arch/amiga/dev/grf_et.c6
-rw-r--r--sys/arch/amiga/dev/grf_rh.c6
-rw-r--r--sys/arch/amiga/dev/grf_rt.c6
-rw-r--r--sys/arch/amiga/dev/grf_ul.c6
-rw-r--r--sys/arch/amiga/dev/view.c7
7 files changed, 23 insertions, 20 deletions
diff --git a/sys/arch/amiga/dev/grf_cl.c b/sys/arch/amiga/dev/grf_cl.c
index e26bb3243ef..4742e8e0e2f 100644
--- a/sys/arch/amiga/dev/grf_cl.c
+++ b/sys/arch/amiga/dev/grf_cl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf_cl.c,v 1.16 2002/03/14 01:26:28 millert Exp $ */
+/* $OpenBSD: grf_cl.c,v 1.17 2002/08/02 16:13:07 millert Exp $ */
/* $NetBSD: grf_cl.c,v 1.20 1997/07/29 17:46:24 veego Exp $ */
/*
@@ -1147,7 +1147,7 @@ cl_getcmap(gfp, cmap)
if (cmap->count == 0 || cmap->index >= 256)
return 0;
- if (cmap->index + cmap->count > 256)
+ if (cmap->count > 256 - cmap->index)
cmap->count = 256 - cmap->index;
ba = gfp->g_regkva;
@@ -1182,7 +1182,7 @@ cl_putcmap(gfp, cmap)
if (cmap->count == 0 || cmap->index >= 256)
return (0);
- if (cmap->index + cmap->count > 256)
+ if (cmap->count > 256 - cmap->index)
cmap->count = 256 - cmap->index;
/* first copy the colors into kernelspace */
diff --git a/sys/arch/amiga/dev/grf_cv.c b/sys/arch/amiga/dev/grf_cv.c
index 6852437bcc3..3c6e7fce954 100644
--- a/sys/arch/amiga/dev/grf_cv.c
+++ b/sys/arch/amiga/dev/grf_cv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf_cv.c,v 1.17 2002/03/14 01:26:28 millert Exp $ */
+/* $OpenBSD: grf_cv.c,v 1.18 2002/08/02 16:13:07 millert Exp $ */
/* $NetBSD: grf_cv.c,v 1.24 1997/07/30 11:05:55 veego Exp $ */
/*
@@ -1078,7 +1078,7 @@ cv_getcmap(gfp, cmap)
if (cmap->count == 0 || cmap->index >= 256)
return (0);
- if (cmap->index + cmap->count > 256)
+ if (cmap->count > 256 - cmap->index)
cmap->count = 256 - cmap->index;
/* first read colors out of the chip, then copyout to userspace */
@@ -1118,7 +1118,7 @@ cv_putcmap(gfp, cmap)
if (cmap->count == 0 || cmap->index >= 256)
return (0);
- if (cmap->index + cmap->count > 256)
+ if (cmap->count > 256 - cmap->index)
cmap->count = 256 - cmap->index;
/* first copy the colors into kernelspace */
diff --git a/sys/arch/amiga/dev/grf_et.c b/sys/arch/amiga/dev/grf_et.c
index 30e1dfd8d60..37273a7dec0 100644
--- a/sys/arch/amiga/dev/grf_et.c
+++ b/sys/arch/amiga/dev/grf_et.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf_et.c,v 1.8 2002/03/14 01:26:28 millert Exp $ */
+/* $OpenBSD: grf_et.c,v 1.9 2002/08/02 16:13:07 millert Exp $ */
/* $NetBSD: grf_et.c,v 1.10 1997/07/29 17:46:31 veego Exp $ */
/*
@@ -874,7 +874,7 @@ et_getcmap(gfp, cmap)
if (cmap->count == 0 || cmap->index >= 256)
return 0;
- if (cmap->index + cmap->count > 256)
+ if (cmap->count > 256 - cmap->index)
cmap->count = 256 - cmap->index;
ba = gfp->g_regkva;
@@ -927,7 +927,7 @@ et_putcmap(gfp, cmap)
if (cmap->count == 0 || cmap->index >= 256)
return (0);
- if (cmap->index + cmap->count > 256)
+ if (cmap->count > 256 - cmap->index)
cmap->count = 256 - cmap->index;
/* first copy the colors into kernelspace */
diff --git a/sys/arch/amiga/dev/grf_rh.c b/sys/arch/amiga/dev/grf_rh.c
index a2963a6cb65..5cd849ee79a 100644
--- a/sys/arch/amiga/dev/grf_rh.c
+++ b/sys/arch/amiga/dev/grf_rh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf_rh.c,v 1.15 2002/04/29 06:26:50 pvalchev Exp $ */
+/* $OpenBSD: grf_rh.c,v 1.16 2002/08/02 16:13:07 millert Exp $ */
/* $NetBSD: grf_rh.c,v 1.27 1997/07/29 17:52:05 veego Exp $ */
/*
@@ -1836,7 +1836,7 @@ rh_getcmap (gfp, cmap)
if (cmap->count == 0 || cmap->index >= 256)
return 0;
- if (cmap->index + cmap->count > 256)
+ if (cmap->count > 256 - cmap->index)
cmap->count = 256 - cmap->index;
ba = gfp->g_regkva;
@@ -1873,7 +1873,7 @@ rh_putcmap (gfp, cmap)
if (cmap->count == 0 || cmap->index >= 256)
return(0);
- if (cmap->index + cmap->count > 256)
+ if (cmap->count > 256 - cmap->index)
cmap->count = 256 - cmap->index;
/* first copy the colors into kernelspace */
diff --git a/sys/arch/amiga/dev/grf_rt.c b/sys/arch/amiga/dev/grf_rt.c
index 1c6e5907f8e..784d86eecfd 100644
--- a/sys/arch/amiga/dev/grf_rt.c
+++ b/sys/arch/amiga/dev/grf_rt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf_rt.c,v 1.13 2002/04/29 06:26:50 pvalchev Exp $ */
+/* $OpenBSD: grf_rt.c,v 1.14 2002/08/02 16:13:07 millert Exp $ */
/* $NetBSD: grf_rt.c,v 1.35 1997/07/29 17:52:09 veego Exp $ */
/*
@@ -1158,7 +1158,7 @@ rt_getcmap (gfp, cmap)
if (cmap->count == 0 || cmap->index >= 256)
return (0);
- if (cmap->index + cmap->count > 256)
+ if (cmap->count > 256 - cmap->index)
cmap->count = 256 - cmap->index;
ba = gfp->g_regkva;
@@ -1196,7 +1196,7 @@ rt_putcmap (gfp, cmap)
if (cmap->count == 0 || cmap->index >= 256)
return 0;
- if (cmap->index + cmap->count > 256)
+ if (cmap->count > 256 - cmap->index)
cmap->count = 256 - cmap->index;
/* first copy the colors into kernelspace */
diff --git a/sys/arch/amiga/dev/grf_ul.c b/sys/arch/amiga/dev/grf_ul.c
index 5cc7dfbe856..b456f377a3d 100644
--- a/sys/arch/amiga/dev/grf_ul.c
+++ b/sys/arch/amiga/dev/grf_ul.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf_ul.c,v 1.14 2002/03/14 01:26:29 millert Exp $ */
+/* $OpenBSD: grf_ul.c,v 1.15 2002/08/02 16:13:07 millert Exp $ */
/* $NetBSD: grf_ul.c,v 1.24 1997/07/29 17:50:01 veego Exp $ */
#define UL_DEBUG
@@ -799,7 +799,7 @@ ul_getcmap (gp, cmap, dev)
if (cmap->count == 0 || cmap->index >= mxidx)
return 0;
- if (cmap->index + cmap->count > mxidx)
+ if (cmap->count > mxidx - cmap->index)
cmap->count = mxidx - cmap->index;
/* just copyout from the shadow color map */
@@ -842,7 +842,7 @@ ul_putcmap (gp, cmap, dev)
if (cmap->count == 0 || cmap->index >= mxidx)
return 0;
- if (cmap->index + cmap->count > mxidx)
+ if (cmap->count > mxidx - cmap->index)
cmap->count = mxidx - cmap->index;
/* first copyin to our shadow color map */
diff --git a/sys/arch/amiga/dev/view.c b/sys/arch/amiga/dev/view.c
index c5d2e21c40d..7fe31dcdd32 100644
--- a/sys/arch/amiga/dev/view.c
+++ b/sys/arch/amiga/dev/view.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: view.c,v 1.7 2002/06/11 03:25:43 miod Exp $ */
+/* $OpenBSD: view.c,v 1.8 2002/08/02 16:13:07 millert Exp $ */
/* $NetBSD: view.c,v 1.16 1996/10/13 03:07:35 christos Exp $ */
/*
@@ -348,7 +348,10 @@ view_get_colormap (vu, ucm)
u_long *uep;
/* add one incase of zero, ick. */
- cme = malloc(sizeof (u_long)*(ucm->size + 1), M_IOCTLOPS, M_WAITOK);
+ if (ucm->size >= SIZE_T_MAX / sizeof(u_long))
+ return (EINVAL);
+ cme = malloc(sizeof(u_long) * ((size_t)ucm->size + 1), M_IOCTLOPS,
+ M_WAITOK);
uep = ucm->entry;
error = 0;