Fix endian bugs accessing ioctl arguments that are passed by value.

This commit is contained in:
Jake Burkholder 2003-08-24 00:35:10 +00:00
parent 5b6a41bddf
commit 4ceb2b2039
2 changed files with 5 additions and 5 deletions

View File

@ -654,7 +654,7 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct thread *
#endif /* SC_NO_MODE_CHANGE */
case KDSETMODE: /* set current mode of this (virtual) console */
switch (*(int *)data) {
switch (*(intptr_t *)data) {
case KD_TEXT: /* switch to TEXT (known) mode */
/*
* If scp->mode is of graphics modes, we don't know which
@ -783,7 +783,7 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct thread *
return 0;
case KDSBORDER: /* set border color of this (virtual) console */
scp->border = *data;
scp->border = *(intptr_t *)data;
if (scp == scp->sc->cur_scp)
sc_set_border(scp, scp->border);
return 0;

View File

@ -961,7 +961,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
return EPERM;
}
error = EINVAL;
switch(*(int *)data) {
switch(*(intptr_t *)data) {
case VT_FALSE: /* user refuses to release screen, abort */
if ((error = finish_vt_rel(scp, FALSE, &s)) == 0)
DPRINTF(5, ("sc%d: VT_FALSE\n", sc->unit));
@ -991,14 +991,14 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
return EINVAL;
case VT_ACTIVATE: /* switch to screen *data */
i = (*(int *)data == 0) ? scp->index : (*(int *)data - 1);
i = (*(intptr_t *)data == 0) ? scp->index : (*(intptr_t *)data - 1);
s = spltty();
sc_clean_up(sc->cur_scp);
splx(s);
return sc_switch_scr(sc, i);
case VT_WAITACTIVE: /* wait for switch to occur */
i = (*(int *)data == 0) ? scp->index : (*(int *)data - 1);
i = (*(intptr_t *)data == 0) ? scp->index : (*(intptr_t *)data - 1);
if ((i < sc->first_vty) || (i >= sc->first_vty + sc->vtys))
return EINVAL;
s = spltty();