Skip to content

Commit fba616a

Browse files
ebiggersrafaeljw
authored andcommitted
PM / hibernate: Remove unnecessary compat ioctl overrides
Since the SNAPSHOT_GET_IMAGE_SIZE, SNAPSHOT_AVAIL_SWAP_SIZE, and SNAPSHOT_ALLOC_SWAP_PAGE ioctls produce an loff_t result, and loff_t is always 64-bit even in the compat case, there's no reason to have the special compat handling for these ioctls. Just remove this unneeded code so that these ioctls call into snapshot_ioctl() directly, doing just the compat_ptr() conversion on the argument. (This unnecessary code was also causing a KMSAN false positive.) Signed-off-by: Eric Biggers <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 51995ff commit fba616a

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

kernel/power/user.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -409,21 +409,7 @@ snapshot_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
409409
switch (cmd) {
410410
case SNAPSHOT_GET_IMAGE_SIZE:
411411
case SNAPSHOT_AVAIL_SWAP_SIZE:
412-
case SNAPSHOT_ALLOC_SWAP_PAGE: {
413-
compat_loff_t __user *uoffset = compat_ptr(arg);
414-
loff_t offset;
415-
mm_segment_t old_fs;
416-
int err;
417-
418-
old_fs = get_fs();
419-
set_fs(KERNEL_DS);
420-
err = snapshot_ioctl(file, cmd, (unsigned long) &offset);
421-
set_fs(old_fs);
422-
if (!err && put_user(offset, uoffset))
423-
err = -EFAULT;
424-
return err;
425-
}
426-
412+
case SNAPSHOT_ALLOC_SWAP_PAGE:
427413
case SNAPSHOT_CREATE_IMAGE:
428414
return snapshot_ioctl(file, cmd,
429415
(unsigned long) compat_ptr(arg));

0 commit comments

Comments
 (0)