Skip to content

Commit ca9e45b

Browse files
yiliu1765awilliam
authored andcommitted
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]>
1 parent 1c9dc07 commit ca9e45b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/vfio/vfio_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,7 @@ static long vfio_device_fops_unl_ioctl(struct file *filep,
11461146
{
11471147
struct vfio_device_file *df = filep->private_data;
11481148
struct vfio_device *device = df->device;
1149+
void __user *uptr = (void __user *)arg;
11491150
int ret;
11501151

11511152
/* Paired with smp_store_release() following vfio_df_open() */
@@ -1158,7 +1159,7 @@ static long vfio_device_fops_unl_ioctl(struct file *filep,
11581159

11591160
switch (cmd) {
11601161
case VFIO_DEVICE_FEATURE:
1161-
ret = vfio_ioctl_device_feature(device, (void __user *)arg);
1162+
ret = vfio_ioctl_device_feature(device, uptr);
11621163
break;
11631164

11641165
default:

0 commit comments

Comments
 (0)