Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1438305

[patch] ocfs2: silence an integer overflow warning

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject [patch] ocfs2: silence an integer overflow warning
Date 2016-07-07 10:20 +0200
Message-ID <rScHo-4lY-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


My static checker complains that ->me_start + ->me_len can overflow.
I haven't followed it through to see the implications but it seems
simple enough to prevent the overflow.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
move_extents in other less common file systems have this same warning as
well.

diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
index e3d05d9..9ff405a 100644
--- a/fs/ocfs2/move_extents.c
+++ b/fs/ocfs2/move_extents.c
@@ -1014,7 +1014,8 @@ int ocfs2_ioctl_move_extents(struct file *filp, void __user *argp)
 		goto out_free;
 	}
 
-	if (range.me_start > i_size_read(inode)) {
+	if (range.me_start > i_size_read(inode) ||
+	    range.me_len > i_size_read(inode)) {
 		status = -EINVAL;
 		goto out_free;
 	}

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[patch] ocfs2: silence an integer overflow warning Dan Carpenter <dan.carpenter@oracle.com> - 2016-07-07 10:20 +0200

csiph-web