diff options
| author | Yi Liu <[email protected]> | 2023-07-18 06:55:46 -0700 |
|---|---|---|
| committer | Alex Williamson <[email protected]> | 2023-07-25 10:20:15 -0600 |
| commit | ca9e45b414709b9a7279d396ec3d338b057349a8 (patch) | |
| tree | e20647f824e200d23d2e7ceae9605089eee3cc9b | |
| parent | 1c9dc07487cb0f246075b2d3b305bba91156d376 (diff) | |
vfio: Avoid repeated user pointer cast in vfio_device_fops_unl_ioctl()
This adds a local variable to store the user pointer cast result from arg.
It avoids the repeated casts in the code when more ioctls are added.
Reviewed-by: Jason Gunthorpe <[email protected]>
Tested-by: Yanting Jiang <[email protected]>
Signed-off-by: Yi Liu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alex Williamson <[email protected]>
| -rw-r--r-- | drivers/vfio/vfio_main.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c index 5f7c3151d8c0..a2744cb64c6d 100644 --- a/drivers/vfio/vfio_main.c +++ b/drivers/vfio/vfio_main.c @@ -1146,6 +1146,7 @@ static long vfio_device_fops_unl_ioctl(struct file *filep, { struct vfio_device_file *df = filep->private_data; struct vfio_device *device = df->device; + void __user *uptr = (void __user *)arg; int ret; /* Paired with smp_store_release() following vfio_df_open() */ @@ -1158,7 +1159,7 @@ static long vfio_device_fops_unl_ioctl(struct file *filep, switch (cmd) { case VFIO_DEVICE_FEATURE: - ret = vfio_ioctl_device_feature(device, (void __user *)arg); + ret = vfio_ioctl_device_feature(device, uptr); break; default: |