[patch] add copy_to_user result check

From: Coywolf Qi Hunt
Date: Sun Jul 17 2005 - 04:04:26 EST


hello,

GCC warns me this problem. This patch adds copy_to_user result check
in sys_select() and sys_pselect7().


Signed-off-by: Coywolf Qi Hunt <coywolf@xxxxxxxxxx>
---
diff -pruN 2.6.13-rc3-mm1/fs/select.c 2.6.13-rc3-mm1-cy1/fs/select.c
--- 2.6.13-rc3-mm1/fs/select.c 2005-07-15 23:51:35.000000000 +0800
+++ 2.6.13-rc3-mm1-cy1/fs/select.c 2005-07-17 16:26:58.000000000 +0800
@@ -401,7 +401,8 @@ asmlinkage long sys_select(int n, fd_set
tv.tv_sec++;
tv.tv_usec -= 1000000;
}
- copy_to_user(tvp, &tv, sizeof(tv));
+ if (copy_to_user(tvp, &tv, sizeof(tv)))
+ return -EFAULT;
}

return ret;
@@ -459,7 +460,8 @@ asmlinkage long sys_pselect7(int n, fd_s
ts.tv_sec++;
ts.tv_nsec -= 1000000000;
}
- copy_to_user(tsp, &ts, sizeof(ts));
+ if (copy_to_user(tsp, &ts, sizeof(ts)))
+ return -EFAULT;
}

if (sigmask)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/