diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-05-16 20:34:00 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-05-16 20:34:00 +0000 |
commit | b9313931c23fbd6b43ee9ab25d569edd9d09ca6f (patch) | |
tree | 58482aa4f422225e61152f67bffcf89b625e69cc /sys/dev | |
parent | bfe5e634b33fca91e0e7192bd901dcbe3d0dfc79 (diff) |
Use a temporary variable for now to sidestep -Wbounded checking when
copying vendor[8]/product[16]/revision[4] out of struct scsi_inquiry_data
together with one memcopy.
ok krw
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/ami.c | 12 | ||||
-rw-r--r-- | sys/dev/ic/mfi.c | 12 | ||||
-rw-r--r-- | sys/dev/ic/mpi.c | 7 |
3 files changed, 18 insertions, 13 deletions
diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c index fa18cc5529f..4113ba72f51 100644 --- a/sys/dev/ic/ami.c +++ b/sys/dev/ic/ami.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ami.c,v 1.201 2010/05/01 08:14:26 mk Exp $ */ +/* $OpenBSD: ami.c,v 1.202 2010/05/16 20:33:59 nicm Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -2137,7 +2137,7 @@ int ami_disk(struct ami_softc *sc, struct bioc_disk *bd, struct ami_big_diskarray *p) { - char vend[8+16+4+1]; + char vend[8+16+4+1], *vendp; char ser[32 + 1]; struct scsi_inquiry_data inqbuf; struct scsi_vpd_serial vpdbuf; @@ -2161,7 +2161,8 @@ ami_disk(struct ami_softc *sc, struct bioc_disk *bd, if (ami_drv_inq(sc, ch, tg, 0, &inqbuf)) goto bail; - bcopy(inqbuf.vendor, vend, sizeof vend - 1); + vendp = inqbuf.vendor; + bcopy(vendp, vend, sizeof vend - 1); vend[sizeof vend - 1] = '\0'; strlcpy(bd->bd_vendor, vend, sizeof(bd->bd_vendor)); @@ -2331,7 +2332,7 @@ ami_ioctl_disk(struct ami_softc *sc, struct bioc_disk *bd) int off; int error = EINVAL; u_int16_t ch, tg; - char vend[8+16+4+1]; + char vend[8+16+4+1], *vendp; char ser[32 + 1]; p = malloc(sizeof *p, M_DEVBUF, M_NOWAIT); @@ -2405,7 +2406,8 @@ ami_ioctl_disk(struct ami_softc *sc, struct bioc_disk *bd) } if (!ami_drv_inq(sc, ch, tg, 0, &inqbuf)) { - bcopy(inqbuf.vendor, vend, sizeof vend - 1); + vendp = inqbuf.vendor; + bcopy(vendp, vend, sizeof vend - 1); vend[sizeof vend - 1] = '\0'; strlcpy(bd->bd_vendor, vend, sizeof(bd->bd_vendor)); diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c index d388097110c..2bd11f2ecb1 100644 --- a/sys/dev/ic/mfi.c +++ b/sys/dev/ic/mfi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfi.c,v 1.103 2010/04/22 12:33:30 oga Exp $ */ +/* $OpenBSD: mfi.c,v 1.104 2010/05/16 20:33:59 nicm Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * @@ -1528,7 +1528,7 @@ mfi_ioctl_disk(struct mfi_softc *sc, struct bioc_disk *bd) struct mfi_ld_cfg *ld; struct mfi_pd_details *pd; struct scsi_inquiry_data *inqbuf; - char vend[8+16+4+1]; + char vend[8+16+4+1], *vendp; int rv = EINVAL; int arr, vol, disk, span; uint8_t mbox[MFI_MBOX_SIZE]; @@ -1614,7 +1614,8 @@ mfi_ioctl_disk(struct mfi_softc *sc, struct bioc_disk *bd) bd->bd_channel = pd->mpd_enc_idx; inqbuf = (struct scsi_inquiry_data *)&pd->mpd_inq_data; - memcpy(vend, inqbuf->vendor, sizeof vend - 1); + vendp = inqbuf->vendor; + memcpy(vend, vendp, sizeof vend - 1); vend[sizeof vend - 1] = '\0'; strlcpy(bd->bd_vendor, vend, sizeof(bd->bd_vendor)); @@ -1811,7 +1812,7 @@ mfi_bio_hs(struct mfi_softc *sc, int volid, int type, void *bio_hs) struct bioc_disk *sdhs; struct bioc_vol *vdhs; struct scsi_inquiry_data *inqbuf; - char vend[8+16+4+1]; + char vend[8+16+4+1], *vendp; int i, rv = EINVAL; uint32_t size; uint8_t mbox[MFI_MBOX_SIZE]; @@ -1881,7 +1882,8 @@ mfi_bio_hs(struct mfi_softc *sc, int volid, int type, void *bio_hs) sdhs->bd_channel = pd->mpd_enc_idx; sdhs->bd_target = pd->mpd_enc_slot; inqbuf = (struct scsi_inquiry_data *)&pd->mpd_inq_data; - memcpy(vend, inqbuf->vendor, sizeof vend - 1); + vendp = inqbuf->vendor; + memcpy(vend, vendp, sizeof vend - 1); vend[sizeof vend - 1] = '\0'; strlcpy(sdhs->bd_vendor, vend, sizeof(sdhs->bd_vendor)); break; diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c index c097a5a443b..786eaf680e1 100644 --- a/sys/dev/ic/mpi.c +++ b/sys/dev/ic/mpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpi.c,v 1.147 2010/05/09 22:03:56 dlg Exp $ */ +/* $OpenBSD: mpi.c,v 1.148 2010/05/16 20:33:59 nicm Exp $ */ /* * Copyright (c) 2005, 2006, 2009 David Gwynne <dlg@openbsd.org> @@ -2832,6 +2832,7 @@ mpi_ioctl_vol(struct mpi_softc *sc, struct bioc_vol *bv) struct device *dev; struct scsi_link *link; struct mpi_cfg_raid_vol_pg0 *rpg0; + char *vendp; id = bv->bv_volid; if (mpi_bio_get_pg0_raid(sc, id)) @@ -2905,8 +2906,8 @@ mpi_ioctl_vol(struct mpi_softc *sc, struct bioc_vol *bv) /* are we it? */ if (vol == bv->bv_volid) { dev = link->device_softc; - memcpy(bv->bv_vendor, link->inqdata.vendor, - sizeof bv->bv_vendor); + vendp = link->inqdata.vendor; + memcpy(bv->bv_vendor, vendp, sizeof bv->bv_vendor); bv->bv_vendor[sizeof(bv->bv_vendor) - 1] = '\0'; strlcpy(bv->bv_dev, dev->dv_xname, sizeof bv->bv_dev); break; |