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/ic/mfi.c | |
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/ic/mfi.c')
-rw-r--r-- | sys/dev/ic/mfi.c | 12 |
1 files changed, 7 insertions, 5 deletions
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; |