Skip to contentSkip to conversation

drivers: use IS_ERR_VALUE() in memory_lseek()

PATCH New Rasmus Villemoes 1 participant 1 message Jun 5, 2013 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: 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 -).

---
 drivers/char/mem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/mem.c +1 -1
index 1ccbe94..2ca6d78 100644
@@ -745,7 +745,7 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig)
 		offset += file->f_pos;
 	case SEEK_SET:
 		/* 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;
 			break;
 		}
Signature · 1 line
1.7.9.5