aboutsummaryrefslogtreecommitdiffstats
path: root/fs/stat.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2010-08-11 06:26:22 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-13 19:53:13 -0400
commitc7887325230aec47d47a32562a6e26014a0fafca (patch)
tree10535943dace59ddb01d3440aa582bc4640e8016 /fs/stat.c
parentb84ae4a1401a731ef5fee987c0cb08743838dda7 (diff)
Mark arguments to certain syscalls as being const
Mark arguments to certain system calls as being const where they should be but aren't. The list includes: (*) The filename arguments of various stat syscalls, execve(), various utimes syscalls and some mount syscalls. (*) The filename arguments of some syscall helpers relating to the above. (*) The buffer argument of various write syscalls. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/stat.c')
-rw-r--r--fs/stat.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/fs/stat.c b/fs/stat.c
index c4ecd52c5737..12e90e213900 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -68,7 +68,8 @@ int vfs_fstat(unsigned int fd, struct kstat *stat)
68} 68}
69EXPORT_SYMBOL(vfs_fstat); 69EXPORT_SYMBOL(vfs_fstat);
70 70
71int vfs_fstatat(int dfd, char __user *filename, struct kstat *stat, int flag) 71int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,
72 int flag)
72{ 73{
73 struct path path; 74 struct path path;
74 int error = -EINVAL; 75 int error = -EINVAL;
@@ -91,13 +92,13 @@ out:
91} 92}
92EXPORT_SYMBOL(vfs_fstatat); 93EXPORT_SYMBOL(vfs_fstatat);
93 94
94int vfs_stat(char __user *name, struct kstat *stat) 95int vfs_stat(const char __user *name, struct kstat *stat)
95{ 96{
96 return vfs_fstatat(AT_FDCWD, name, stat, 0); 97 return vfs_fstatat(AT_FDCWD, name, stat, 0);
97} 98}
98EXPORT_SYMBOL(vfs_stat); 99EXPORT_SYMBOL(vfs_stat);
99 100
100int vfs_lstat(char __user *name, struct kstat *stat) 101int vfs_lstat(const char __user *name, struct kstat *stat)
101{ 102{
102 return vfs_fstatat(AT_FDCWD, name, stat, AT_SYMLINK_NOFOLLOW); 103 return vfs_fstatat(AT_FDCWD, name, stat, AT_SYMLINK_NOFOLLOW);
103} 104}
@@ -147,7 +148,8 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * sta
147 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 148 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
148} 149}
149 150
150SYSCALL_DEFINE2(stat, char __user *, filename, struct __old_kernel_stat __user *, statbuf) 151SYSCALL_DEFINE2(stat, const char __user *, filename,
152 struct __old_kernel_stat __user *, statbuf)
151{ 153{
152 struct kstat stat; 154 struct kstat stat;
153 int error; 155 int error;
@@ -159,7 +161,8 @@ SYSCALL_DEFINE2(stat, char __user *, filename, struct __old_kernel_stat __user *
159 return cp_old_stat(&stat, statbuf); 161 return cp_old_stat(&stat, statbuf);
160} 162}
161 163
162SYSCALL_DEFINE2(lstat, char __user *, filename, struct __old_kernel_stat __user *, statbuf) 164SYSCALL_DEFINE2(lstat, const char __user *, filename,
165 struct __old_kernel_stat __user *, statbuf)
163{ 166{
164 struct kstat stat; 167 struct kstat stat;
165 int error; 168 int error;
@@ -234,7 +237,8 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
234 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 237 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
235} 238}
236 239
237SYSCALL_DEFINE2(newstat, char __user *, filename, struct stat __user *, statbuf) 240SYSCALL_DEFINE2(newstat, const char __user *, filename,
241 struct stat __user *, statbuf)
238{ 242{
239 struct kstat stat; 243 struct kstat stat;
240 int error = vfs_stat(filename, &stat); 244 int error = vfs_stat(filename, &stat);
@@ -244,7 +248,8 @@ SYSCALL_DEFINE2(newstat, char __user *, filename, struct stat __user *, statbuf)
244 return cp_new_stat(&stat, statbuf); 248 return cp_new_stat(&stat, statbuf);
245} 249}
246 250
247SYSCALL_DEFINE2(newlstat, char __user *, filename, struct stat __user *, statbuf) 251SYSCALL_DEFINE2(newlstat, const char __user *, filename,
252 struct stat __user *, statbuf)
248{ 253{
249 struct kstat stat; 254 struct kstat stat;
250 int error; 255 int error;
@@ -257,7 +262,7 @@ SYSCALL_DEFINE2(newlstat, char __user *, filename, struct stat __user *, statbuf
257} 262}
258 263
259#if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT) 264#if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT)
260SYSCALL_DEFINE4(newfstatat, int, dfd, char __user *, filename, 265SYSCALL_DEFINE4(newfstatat, int, dfd, const char __user *, filename,
261 struct stat __user *, statbuf, int, flag) 266 struct stat __user *, statbuf, int, flag)
262{ 267{
263 struct kstat stat; 268 struct kstat stat;
@@ -355,7 +360,8 @@ static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf)
355 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 360 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
356} 361}
357 362
358SYSCALL_DEFINE2(stat64, char __user *, filename, struct stat64 __user *, statbuf) 363SYSCALL_DEFINE2(stat64, const char __user *, filename,
364 struct stat64 __user *, statbuf)
359{ 365{
360 struct kstat stat; 366 struct kstat stat;
361 int error = vfs_stat(filename, &stat); 367 int error = vfs_stat(filename, &stat);
@@ -366,7 +372,8 @@ SYSCALL_DEFINE2(stat64, char __user *, filename, struct stat64 __user *, statbuf
366 return error; 372 return error;
367} 373}
368 374
369SYSCALL_DEFINE2(lstat64, char __user *, filename, struct stat64 __user *, statbuf) 375SYSCALL_DEFINE2(lstat64, const char __user *, filename,
376 struct stat64 __user *, statbuf)
370{ 377{
371 struct kstat stat; 378 struct kstat stat;
372 int error = vfs_lstat(filename, &stat); 379 int error = vfs_lstat(filename, &stat);
@@ -388,7 +395,7 @@ SYSCALL_DEFINE2(fstat64, unsigned long, fd, struct stat64 __user *, statbuf)
388 return error; 395 return error;
389} 396}
390 397
391SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename, 398SYSCALL_DEFINE4(fstatat64, int, dfd, const char __user *, filename,
392 struct stat64 __user *, statbuf, int, flag) 399 struct stat64 __user *, statbuf, int, flag)
393{ 400{
394 struct kstat stat; 401 struct kstat stat;