Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71811f32 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Greg Kroah-Hartman
Browse files

drivers: char: mem: use IS_ERR_VALUE() in memory_lseek()



Use IS_ERR_VALUE() instead of comparing the new offset to a hard-coded
value of -MAX_ERRNO (which is also off-by-one due to the use of ~
instead of -).

Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 29ddae2a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -745,7 +745,7 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig)
		offset += file->f_pos;
		offset += file->f_pos;
	case SEEK_SET:
	case SEEK_SET:
		/* to avoid userland mistaking f_pos=-9 as -EBADF=-9 */
		/* to avoid userland mistaking f_pos=-9 as -EBADF=-9 */
		if ((unsigned long long)offset >= ~0xFFFULL) {
		if (IS_ERR_VALUE((unsigned long long)offset)) {
			ret = -EOVERFLOW;
			ret = -EOVERFLOW;
			break;
			break;
		}
		}