diff options
Diffstat (limited to 'usr/src/uts/common/io')
-rw-r--r-- | usr/src/uts/common/io/blkdev/blkdev.c | 13 | ||||
-rw-r--r-- | usr/src/uts/common/io/lofi.c | 9 | ||||
-rw-r--r-- | usr/src/uts/common/io/scsi/targets/sd.c | 13 |
3 files changed, 32 insertions, 3 deletions
diff --git a/usr/src/uts/common/io/blkdev/blkdev.c b/usr/src/uts/common/io/blkdev/blkdev.c index e9734d1672..c0bdb3dab2 100644 --- a/usr/src/uts/common/io/blkdev/blkdev.c +++ b/usr/src/uts/common/io/blkdev/blkdev.c @@ -1510,6 +1510,7 @@ bd_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *credp, int *rvalp) } case DKIOCGMEDIAINFOEXT: { struct dk_minfo_ext miext; + size_t len; /* make sure our state information is current */ bd_update_state(bd); @@ -1518,7 +1519,17 @@ bd_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *credp, int *rvalp) miext.dki_lbsize = (1U << bd->d_blkshift); miext.dki_pbsize = (1U << bd->d_pblkshift); miext.dki_capacity = bd->d_numblks; - if (ddi_copyout(&miext, ptr, sizeof (miext), flag)) { + + switch (ddi_model_convert_from(flag & FMODELS)) { + case DDI_MODEL_ILP32: + len = sizeof (struct dk_minfo_ext32); + break; + default: + len = sizeof (struct dk_minfo_ext); + break; + } + + if (ddi_copyout(&miext, ptr, len, flag)) { return (EFAULT); } return (0); diff --git a/usr/src/uts/common/io/lofi.c b/usr/src/uts/common/io/lofi.c index f59c7ec848..4ccef8c3f4 100644 --- a/usr/src/uts/common/io/lofi.c +++ b/usr/src/uts/common/io/lofi.c @@ -3340,7 +3340,14 @@ lofi_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *credp, if (cmd == DKIOCGMEDIAINFOEXT) { media_info.dki_pbsize = 1U << lsp->ls_pbshift; - size = sizeof (struct dk_minfo_ext); + switch (ddi_model_convert_from(flag & FMODELS)) { + case DDI_MODEL_ILP32: + size = sizeof (struct dk_minfo_ext32); + break; + default: + size = sizeof (struct dk_minfo_ext); + break; + } } else { size = sizeof (struct dk_minfo); } diff --git a/usr/src/uts/common/io/scsi/targets/sd.c b/usr/src/uts/common/io/scsi/targets/sd.c index eb694bd3bb..4784fdeec4 100644 --- a/usr/src/uts/common/io/scsi/targets/sd.c +++ b/usr/src/uts/common/io/scsi/targets/sd.c @@ -24090,13 +24090,24 @@ sd_get_media_info_ext(dev_t dev, caddr_t arg, int flag) { struct dk_minfo_ext mie; int rval = 0; + size_t len; rval = sd_get_media_info_com(dev, &mie.dki_media_type, &mie.dki_lbsize, &mie.dki_capacity, &mie.dki_pbsize); if (rval) return (rval); - if (ddi_copyout(&mie, arg, sizeof (struct dk_minfo_ext), flag)) + + switch (ddi_model_convert_from(flag & FMODELS)) { + case DDI_MODEL_ILP32: + len = sizeof (struct dk_minfo_ext32); + break; + default: + len = sizeof (struct dk_minfo_ext); + break; + } + + if (ddi_copyout(&mie, arg, len, flag)) rval = EFAULT; return (rval); |