summaryrefslogtreecommitdiff
path: root/sys/dev/ic/mpi.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2015-10-23 00:08:58 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2015-10-23 00:08:58 +0000
commitd3634839e7c6589a2e764e0fc9e65df9021c6641 (patch)
treed7f3bc543eec444025640f6e1b5e24b59ed247ed /sys/dev/ic/mpi.c
parenteafdec7e2ce7f4859406e2bd63771cdc05752b9f (diff)
replace pointer arithmetic and casts with offsetof
ok dlg@ krw@
Diffstat (limited to 'sys/dev/ic/mpi.c')
-rw-r--r--sys/dev/ic/mpi.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c
index 44187857201..82df1cb1d0b 100644
--- a/sys/dev/ic/mpi.c
+++ b/sys/dev/ic/mpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpi.c,v 1.202 2015/09/09 18:23:55 deraadt Exp $ */
+/* $OpenBSD: mpi.c,v 1.203 2015/10/23 00:08:57 jsg Exp $ */
/*
* Copyright (c) 2005, 2006, 2009 David Gwynne <dlg@openbsd.org>
@@ -759,7 +759,7 @@ mpi_inq(struct mpi_softc *sc, u_int16_t target, int physdisk)
{
struct mpi_ccb *ccb;
struct scsi_inquiry inq;
- struct {
+ struct inq_bundle {
struct mpi_msg_scsi_io io;
struct mpi_sge sge;
struct scsi_inquiry_data inqbuf;
@@ -809,14 +809,14 @@ mpi_inq(struct mpi_softc *sc, u_int16_t target, int physdisk)
htolem32(&io->data_length, sizeof(struct scsi_inquiry_data));
htolem32(&io->sense_buf_low_addr, ccb->ccb_cmd_dva +
- ((u_int8_t *)&bundle->sense - (u_int8_t *)bundle));
+ offsetof(struct inq_bundle, sense));
htolem32(&sge->sg_hdr, MPI_SGE_FL_TYPE_SIMPLE | MPI_SGE_FL_SIZE_64 |
MPI_SGE_FL_LAST | MPI_SGE_FL_EOB | MPI_SGE_FL_EOL |
(u_int32_t)sizeof(inq));
mpi_dvatosge(sge, ccb->ccb_cmd_dva +
- ((u_int8_t *)&bundle->inqbuf - (u_int8_t *)bundle));
+ offsetof(struct inq_bundle, inqbuf));
if (mpi_poll(sc, ccb, 5000) != 0)
return (1);
@@ -1369,7 +1369,7 @@ mpi_scsi_cmd(struct scsi_xfer *xs)
htolem32(&io->data_length, xs->datalen);
htolem32(&io->sense_buf_low_addr, ccb->ccb_cmd_dva +
- ((u_int8_t *)&mcb->mcb_sense - (u_int8_t *)mcb));
+ offsetof(struct mpi_ccb_bundle, mcb_sense));
if (mpi_load_xs(ccb) != 0)
goto stuffup;