diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-06-26 04:04:25 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-06-26 04:04:25 +0000 |
commit | 7e6dd095a94b39207eff7569000262094cc80685 (patch) | |
tree | c08d0bdb42f47175798f177ae6d03146863dd03f | |
parent | 6c3864b9cbb19c9e544c04ebc635bd25419e2ee1 (diff) |
xs->cmd[n] doesn't mean the n'th byte, because xs->cmd is a struct
*scsi_generic. Change xs->cmd[0] references in sii.c to xs->cmd->opcode
and do (caddr_t) arithmetic when copying chunks into the adw adapter
struct.
Found by Matthew Dempsky, diff tweaked and tested by me.
-rw-r--r-- | sys/arch/vax/dec/sii.c | 9 | ||||
-rw-r--r-- | sys/dev/ic/adw.c | 10 |
2 files changed, 9 insertions, 10 deletions
diff --git a/sys/arch/vax/dec/sii.c b/sys/arch/vax/dec/sii.c index 64d3ac924b5..25700b49a16 100644 --- a/sys/arch/vax/dec/sii.c +++ b/sys/arch/vax/dec/sii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sii.c,v 1.9 2010/05/20 00:55:17 krw Exp $ */ +/* $OpenBSD: sii.c,v 1.10 2010/06/26 04:04:24 krw Exp $ */ /* $NetBSD: sii.c,v 1.42 2000/06/02 20:20:29 mhitch Exp $ */ /* * Copyright (c) 2008 Miodrag Vallat. @@ -817,7 +817,7 @@ again: if (state->cmdlen > 0) { printf("%s: device %d: cmd 0x%x: command data not all sent (%d) 1\n", sc->sc_dev.dv_xname, sc->sc_target, - sc->sc_xs[sc->sc_target]->cmd[0], + sc->sc_xs[sc->sc_target]->cmd->opcode, state->cmdlen); state->cmdlen = 0; #ifdef DEBUG @@ -899,7 +899,7 @@ again: if (state->cmdlen > 0) { printf("%s: device %d: cmd 0x%x: command data not all sent (%d) 2\n", sc->sc_dev.dv_xname, sc->sc_target, - sc->sc_xs[sc->sc_target]->cmd[0], + sc->sc_xs[sc->sc_target]->cmd->opcode, state->cmdlen); state->cmdlen = 0; #ifdef DEBUG @@ -1692,7 +1692,8 @@ sii_CmdDone(sc, target, error) if (sii_debug > 1) { printf("sii_CmdDone: %s target %d cmd 0x%x err %d resid %d\n", sc->sc_dev.dv_xname, - target, xs->cmd[0], error, sc->sc_st[target].buflen); + target, xs->cmd->opcode, error, + sc->sc_st[target].buflen); } #endif diff --git a/sys/dev/ic/adw.c b/sys/dev/ic/adw.c index c8f9a4a1e52..d510df69c64 100644 --- a/sys/dev/ic/adw.c +++ b/sys/dev/ic/adw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adw.c,v 1.44 2010/05/20 00:55:17 krw Exp $ */ +/* $OpenBSD: adw.c,v 1.45 2010/06/26 04:04:24 krw Exp $ */ /* $NetBSD: adw.c,v 1.23 2000/05/27 18:24:50 dante Exp $ */ /* @@ -41,7 +41,6 @@ #include <sys/malloc.h> #include <sys/buf.h> #include <sys/proc.h> -#include <sys/user.h> #include <sys/timeout.h> #include <machine/bus.h> @@ -690,10 +689,9 @@ adw_build_req(xs, ccb, flags) * For wide boards a CDB length maximum of 16 bytes * is supported. */ - bcopy(xs->cmd, &scsiqp->cdb, ((scsiqp->cdb_len = xs->cmdlen) <= 12)? - xs->cmdlen : 12 ); - if(xs->cmdlen > 12) - bcopy(&(xs->cmd[12]), &scsiqp->cdb16, xs->cmdlen - 12); + scsiqp->cdb_len = xs->cmdlen; + bcopy((caddr_t)xs->cmd, &scsiqp->cdb, 12); + bcopy((caddr_t)xs->cmd + 12, &scsiqp->cdb16, 4); scsiqp->target_id = sc_link->target; scsiqp->target_lun = sc_link->lun; |