Skip to content

Commit

Permalink
Don't directly cast unsigned long to void*
Browse files Browse the repository at this point in the history
Cast to uintptr_t first for portability on integer to/from pointer
conversion.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Closes openzfs#9065
  • Loading branch information
kusumi authored and tonyhutter committed Aug 21, 2019
1 parent 9fd769e commit b553c19
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions module/zfs/zfs_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -7110,7 +7110,8 @@ zfsdev_ioctl(struct file *filp, unsigned cmd, unsigned long arg)

zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);

error = ddi_copyin((void *)arg, zc, sizeof (zfs_cmd_t), flag);
error = ddi_copyin((void *)(uintptr_t)arg, zc, sizeof (zfs_cmd_t),
flag);
if (error != 0) {
error = SET_ERROR(EFAULT);
goto out;
Expand Down Expand Up @@ -7269,7 +7270,7 @@ zfsdev_ioctl(struct file *filp, unsigned cmd, unsigned long arg)

out:
nvlist_free(innvl);
rc = ddi_copyout(zc, (void *)arg, sizeof (zfs_cmd_t), flag);
rc = ddi_copyout(zc, (void *)(uintptr_t)arg, sizeof (zfs_cmd_t), flag);
if (error == 0 && rc != 0)
error = SET_ERROR(EFAULT);
if (error == 0 && vec->zvec_allow_log) {
Expand Down

0 comments on commit b553c19

Please sign in to comment.