Skip to contentSkip to conversation

compat: remove unnecessary assignment in compat_rw_copy_check_uvector()

PATCH In review Namhyung Kim 2 participants 4 messages Dec 26, 2010 – Dec 27, 2010 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 compat: remove unnecessary assignment in compat_rw_copy_check_uvector()

*@ret_pointer is initialized to @fast_pointer thus the assignment is redundant.

---
 fs/compat.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
fs/compat.c +1 -3
index b074e9f79148..0a22f973f4b5 100644
@@ -597,10 +597,8 @@ ssize_t compat_rw_copy_check_uvector(int type,
 	if (nr_segs > fast_segs) {
 		ret = -ENOMEM;
 		iov = kmalloc(nr_segs*sizeof(struct iovec), GFP_KERNEL);
-		if (iov == NULL) {
-			*ret_pointer = fast_pointer;
+		if (iov == NULL)
 			goto out;
-		}
 	}
 	*ret_pointer = iov;
 
Signature · 1 line
1.7.3.4.600.g982838b0
#1 lore raw

PATCH 2/3 compat: update comment of compat statfs syscalls

The commit 7ed1ee6118ae ("Take statfs variants to fs/statfs.c") separates out statfs syscalls from fs/open.c. Thus the comment should be changed also.

---
 fs/compat.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/compat.c +1 -1
index 0a22f973f4b5..037df434b038 100644
@@ -257,7 +257,7 @@ static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs *
 }
 
 /*
- * The following statfs calls are copies of code from fs/open.c and
+ * The following statfs calls are copies of code from fs/statfs.c and
  * should be checked against those from time to time
  */
 asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_statfs __user *buf)
Signature · 1 line
1.7.3.4.600.g982838b0
#2 lore raw

PATCH 3/3 compat: copy missing fields in compat_statfs64 to user

In reply to Namhyung Kim

f_flags and f_spare fields were not copied to userspace when compat_sys_[f]statfs64 called.

Cc Christoph Hellwig <[email protected]>

---
It seems struct compat_statfs lacks the f_flags field in it but I'm not sure whether it is intended or not. Is it useful if I make a patch for it too?

 fs/compat.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/compat.c +3 -1
index 037df434b038..2524511518e7 100644
@@ -320,7 +320,9 @@ static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstat
 	    __put_user(kbuf->f_namelen, &ubuf->f_namelen) ||
 	    __put_user(kbuf->f_fsid.val[0], &ubuf->f_fsid.val[0]) ||
 	    __put_user(kbuf->f_fsid.val[1], &ubuf->f_fsid.val[1]) ||
-	    __put_user(kbuf->f_frsize, &ubuf->f_frsize))
+	    __put_user(kbuf->f_frsize, &ubuf->f_frsize) ||
+	    __put_user(kbuf->f_flags, &ubuf->f_flags) ||
+	    __clear_user(ubuf->f_spare, sizeof(ubuf->f_spare)))
 		return -EFAULT;
 	return 0;
 }
Signature · 1 line
1.7.3.4.600.g982838b0
Reviewed-by on v1 3/3
#3 lore raw

Re: [PATCH 3/3] compat: copy missing fields in compat_statfs64 to user

Quoted 9 lines · Namhyung Kim

f_flags and f_spare fields were not copied to userspace when compat_sys_[f]statfs64 called.

Cc Christoph Hellwig <[email protected]>

---
It seems struct compat_statfs lacks the f_flags field in it but I'm not sure whether it is intended or not. Is it useful if I make a patch for it too?

Looks good. We discussed this a while back before it fell under the table again.