summaryrefslogtreecommitdiffstats
path: root/sys/dev/kbdmux/kbdmux.c
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2006-09-19 13:01:20 +0000
committerru <ru@FreeBSD.org>2006-09-19 13:01:20 +0000
commit4474cb04981b55ba539e107ff614964aa7d06367 (patch)
tree9a26be279dea596ac92f7cf542909c1b17b25fc2 /sys/dev/kbdmux/kbdmux.c
parent7c4f63574da6b0549767ea376bfe0960936b2401 (diff)
downloadFreeBSD-src-4474cb04981b55ba539e107ff614964aa7d06367.zip
FreeBSD-src-4474cb04981b55ba539e107ff614964aa7d06367.tar.gz
This time, really fix endian bugs accessing ioctl arguments that
are passed by value. These are KDSKBMODE, KDSETLED, KDSKBSTATE, and KDSETRAD. Tested on: amd64, sparc64 (demo code)
Diffstat (limited to 'sys/dev/kbdmux/kbdmux.c')
-rw-r--r--sys/dev/kbdmux/kbdmux.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/dev/kbdmux/kbdmux.c b/sys/dev/kbdmux/kbdmux.c
index b67c438..e45ed44 100644
--- a/sys/dev/kbdmux/kbdmux.c
+++ b/sys/dev/kbdmux/kbdmux.c
@@ -1051,7 +1051,7 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
case KDSKBMODE: /* set keyboard mode */
KBDMUX_LOCK(state);
- switch (*((int *) arg)) {
+ switch ((int)*(intptr_t *)arg) {
case K_XLATE:
if (state->ks_mode != K_XLATE) {
/* make lock key state and LED state match */
@@ -1062,9 +1062,9 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
case K_RAW:
case K_CODE:
- if (state->ks_mode != *((int *) arg)) {
+ if (state->ks_mode != (int)*(intptr_t *)arg) {
kbdmux_clear_state_locked(state);
- state->ks_mode = *((int *) arg);
+ state->ks_mode = (int)*(intptr_t *)arg;
}
break;
@@ -1086,13 +1086,13 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
KBDMUX_LOCK(state);
/* NOTE: lock key state in ks_state won't be changed */
- if (*((int *) arg) & ~LOCK_MASK) {
+ if ((int)*(intptr_t *)arg & ~LOCK_MASK) {
KBDMUX_UNLOCK(state);
return (EINVAL);
}
- KBD_LED_VAL(kbd) = *((int *) arg);
+ KBD_LED_VAL(kbd) = (int)*(intptr_t *)arg;
/* KDSETLED on all slave keyboards */
SLIST_FOREACH(k, &state->ks_kbds, next)
@@ -1110,14 +1110,14 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
case KDSKBSTATE: /* set lock key state */
KBDMUX_LOCK(state);
- if (*((int *) arg) & ~LOCK_MASK) {
+ if ((int)*(intptr_t *)arg & ~LOCK_MASK) {
KBDMUX_UNLOCK(state);
return (EINVAL);
}
state->ks_state &= ~LOCK_MASK;
- state->ks_state |= *((int *) arg);
+ state->ks_state |= (int)*(intptr_t *)arg;
/* KDSKBSTATE on all slave keyboards */
SLIST_FOREACH(k, &state->ks_kbds, next)
@@ -1147,7 +1147,7 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
break;
mode |= i;
} else
- mode = *((int *) arg);
+ mode = (int)*(intptr_t *)arg;
if (mode & ~0x7f) {
KBDMUX_UNLOCK(state);
OpenPOWER on IntegriCloud