aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2013-03-04 13:37:32 -0500
committerChris Metcalf <cmetcalf@tilera.com>2013-03-04 13:37:32 -0500
commit87c319a2c3c2efd397281089b9cdce3050febeff (patch)
tree762ae66c1cfe3e7f170ba01088273fcc429298a6
parent5a114b98661e3aaa0ac085eb931584dce3b0ef9b (diff)
tile: properly use COMPAT_SYSCALL_DEFINEx
This was pointed out by Al Viro. Using the correct wrappers properly does sign extension as necessary on syscall arguments. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
-rw-r--r--arch/tile/kernel/compat.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c
index 69034e215742..6ea4cdb3c6a0 100644
--- a/arch/tile/kernel/compat.c
+++ b/arch/tile/kernel/compat.c
@@ -32,45 +32,48 @@
32 * adapt the usual convention. 32 * adapt the usual convention.
33 */ 33 */
34 34
35long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high) 35COMPAT_SYSCALL_DEFINE4(truncate64, char __user *, filename, u32, dummy,
36 u32, low, u32, high)
36{ 37{
37 return sys_truncate(filename, ((loff_t)high << 32) | low); 38 return sys_truncate(filename, ((loff_t)high << 32) | low);
38} 39}
39 40
40long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high) 41COMPAT_SYSCALL_DEFINE4(ftruncate64, unsigned int, fd, u32, dummy,
42 u32, low, u32, high)
41{ 43{
42 return sys_ftruncate(fd, ((loff_t)high << 32) | low); 44 return sys_ftruncate(fd, ((loff_t)high << 32) | low);
43} 45}
44 46
45long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count, 47COMPAT_SYSCALL_DEFINE6(pread64, unsigned int, fd, char __user *, ubuf,
46 u32 dummy, u32 low, u32 high) 48 size_t, count, u32, dummy, u32, low, u32, high)
47{ 49{
48 return sys_pread64(fd, ubuf, count, ((loff_t)high << 32) | low); 50 return sys_pread64(fd, ubuf, count, ((loff_t)high << 32) | low);
49} 51}
50 52
51long compat_sys_pwrite64(unsigned int fd, char __user *ubuf, size_t count, 53COMPAT_SYSCALL_DEFINE6(pwrite64, unsigned int, fd, char __user *, ubuf,
52 u32 dummy, u32 low, u32 high) 54 size_t, count, u32, dummy, u32, low, u32, high)
53{ 55{
54 return sys_pwrite64(fd, ubuf, count, ((loff_t)high << 32) | low); 56 return sys_pwrite64(fd, ubuf, count, ((loff_t)high << 32) | low);
55} 57}
56 58
57long compat_sys_lookup_dcookie(u32 low, u32 high, char __user *buf, size_t len) 59COMPAT_SYSCALL_DEFINE4(lookup_dcookie, u32, low, u32, high,
60 char __user *, buf, size_t, len)
58{ 61{
59 return sys_lookup_dcookie(((loff_t)high << 32) | low, buf, len); 62 return sys_lookup_dcookie(((loff_t)high << 32) | low, buf, len);
60} 63}
61 64
62long compat_sys_sync_file_range2(int fd, unsigned int flags, 65COMPAT_SYSCALL_DEFINE6(sync_file_range2, int, fd, unsigned int, flags,
63 u32 offset_lo, u32 offset_hi, 66 u32, offset_lo, u32, offset_hi,
64 u32 nbytes_lo, u32 nbytes_hi) 67 u32, nbytes_lo, u32, nbytes_hi)
65{ 68{
66 return sys_sync_file_range(fd, ((loff_t)offset_hi << 32) | offset_lo, 69 return sys_sync_file_range(fd, ((loff_t)offset_hi << 32) | offset_lo,
67 ((loff_t)nbytes_hi << 32) | nbytes_lo, 70 ((loff_t)nbytes_hi << 32) | nbytes_lo,
68 flags); 71 flags);
69} 72}
70 73
71long compat_sys_fallocate(int fd, int mode, 74COMPAT_SYSCALL_DEFINE6(fallocate, int, fd, int, mode,
72 u32 offset_lo, u32 offset_hi, 75 u32, offset_lo, u32, offset_hi,
73 u32 len_lo, u32 len_hi) 76 u32, len_lo, u32, len_hi)
74{ 77{
75 return sys_fallocate(fd, mode, ((loff_t)offset_hi << 32) | offset_lo, 78 return sys_fallocate(fd, mode, ((loff_t)offset_hi << 32) | offset_lo,
76 ((loff_t)len_hi << 32) | len_lo); 79 ((loff_t)len_hi << 32) | len_lo);
@@ -81,9 +84,9 @@ long compat_sys_fallocate(int fd, int mode,
81 * offset_low as "unsigned long", thus making it possible to pass 84 * offset_low as "unsigned long", thus making it possible to pass
82 * a sign-extended high 32 bits in offset_low. 85 * a sign-extended high 32 bits in offset_low.
83 */ 86 */
84long compat_sys_llseek(unsigned int fd, unsigned int offset_high, 87COMPAT_SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned int, offset_high,
85 unsigned int offset_low, loff_t __user * result, 88 unsigned int, offset_low, loff_t __user *, result,
86 unsigned int origin) 89 unsigned int, origin)
87{ 90{
88 return sys_llseek(fd, offset_high, offset_low, result, origin); 91 return sys_llseek(fd, offset_high, offset_low, result, origin);
89} 92}