Fix pointer-is-uint64_t-sized assumption in the ioctl path

This shows up when compiling freebsd-head on amd64 using gcc-6.4.
The lib32 compat build ends up tripping over this assumption.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: adrian chadd <adrian@freebsd.org>
Closes #11068
Closes #11069
This commit is contained in:
Adrian Chadd 2020-10-15 13:02:43 -07:00 committed by Brian Behlendorf
parent a4ae4998cb
commit 79a357c2a1

View File

@ -55,7 +55,7 @@ zcmd_ioctl_compat(int fd, int request, zfs_cmd_t *zc, const int cflag)
switch (cflag) { switch (cflag) {
case ZFS_CMD_COMPAT_NONE: case ZFS_CMD_COMPAT_NONE:
ncmd = _IOWR('Z', request, zfs_iocparm_t); ncmd = _IOWR('Z', request, zfs_iocparm_t);
zp.zfs_cmd = (uint64_t)zc; zp.zfs_cmd = (uint64_t)(uintptr_t)zc;
zp.zfs_cmd_size = sizeof (zfs_cmd_t); zp.zfs_cmd_size = sizeof (zfs_cmd_t);
zp.zfs_ioctl_version = ZFS_IOCVER_OZFS; zp.zfs_ioctl_version = ZFS_IOCVER_OZFS;
break; break;
@ -64,7 +64,7 @@ zcmd_ioctl_compat(int fd, int request, zfs_cmd_t *zc, const int cflag)
ncmd = _IOWR('Z', newrequest, zfs_iocparm_t); ncmd = _IOWR('Z', newrequest, zfs_iocparm_t);
zc_c = malloc(sizeof (zfs_cmd_legacy_t)); zc_c = malloc(sizeof (zfs_cmd_legacy_t));
zfs_cmd_ozfs_to_legacy(zc, zc_c); zfs_cmd_ozfs_to_legacy(zc, zc_c);
zp.zfs_cmd = (uint64_t)zc_c; zp.zfs_cmd = (uint64_t)(uintptr_t)zc_c;
zp.zfs_cmd_size = sizeof (zfs_cmd_legacy_t); zp.zfs_cmd_size = sizeof (zfs_cmd_legacy_t);
zp.zfs_ioctl_version = ZFS_IOCVER_LEGACY; zp.zfs_ioctl_version = ZFS_IOCVER_LEGACY;
break; break;