Module Name: src
Committed By: christos
Date: Fri Nov 20 19:09:23 UTC 2015
Modified Files:
src/sys/dev/sbus: zx.c
Log Message:
kill subyte.
To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/sbus/zx.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/sbus/zx.c
diff -u src/sys/dev/sbus/zx.c:1.39 src/sys/dev/sbus/zx.c:1.40
--- src/sys/dev/sbus/zx.c:1.39 Wed Jan 11 11:08:57 2012
+++ src/sys/dev/sbus/zx.c Fri Nov 20 14:09:23 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: zx.c,v 1.39 2012/01/11 16:08:57 macallan Exp $ */
+/* $NetBSD: zx.c,v 1.40 2015/11/20 19:09:23 christos Exp $ */
/*
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.39 2012/01/11 16:08:57 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.40 2015/11/20 19:09:23 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -388,7 +388,7 @@ zxioctl(dev_t dev, u_long cmd, void *dat
struct fbcmap *cm;
struct fbcursor *cu;
uint32_t curbits[2][32];
- int rv, v, count, i;
+ int rv, v, count, i, error;
sc = device_lookup_private(&zx_cd, minor(dev));
@@ -537,20 +537,23 @@ zxioctl(dev_t dev, u_long cmd, void *dat
return (rv);
}
if (cu->cmap.red != NULL) {
- if (cu->cmap.index > 2 ||
- cu->cmap.count > 2 - cu->cmap.index)
- return (EINVAL);
- for (i = 0; i < cu->cmap.count; i++) {
- v = sc->sc_curcmap[i + cu->cmap.index + 0];
- if (subyte(&cu->cmap.red[i], v))
- return (EFAULT);
- v = sc->sc_curcmap[i + cu->cmap.index + 2];
- if (subyte(&cu->cmap.green[i], v))
- return (EFAULT);
- v = sc->sc_curcmap[i + cu->cmap.index + 4];
- if (subyte(&cu->cmap.blue[i], v))
- return (EFAULT);
+ uint8_t red[2], green[2], blue[2];
+ const uint8_t *ccm = sc->sc_curcmap;
+ cm = &cu->cmap;
+
+ if (cm->index > 2 || cm->count > 2 - cm->index)
+ return EINVAL;
+
+ for (i = 0; i < cm->count; i++) {
+ red[i] = ccm[i + cm->index + 0];
+ green[i] = ccm[i + cm->index + 2];
+ blue[i] = ccm[i + cm->index + 4];
}
+
+ if ((error = copyout(red, cm->red, cm->count)) ||
+ (error = copyout(green, cm->green, cm->count)) ||
+ (error = copyout(blue, cm->blue, cm->count)))
+ return error;
} else {
cu->cmap.index = 0;
cu->cmap.count = 2;