mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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 <[email protected]>
Acked-by: David S. Miller <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
b84ae4a140
commit
c788732523
44 changed files with 125 additions and 109 deletions
29
fs/stat.c
29
fs/stat.c
|
|
@ -68,7 +68,8 @@ int vfs_fstat(unsigned int fd, struct kstat *stat)
|
|||
}
|
||||
EXPORT_SYMBOL(vfs_fstat);
|
||||
|
||||
int vfs_fstatat(int dfd, char __user *filename, struct kstat *stat, int flag)
|
||||
int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,
|
||||
int flag)
|
||||
{
|
||||
struct path path;
|
||||
int error = -EINVAL;
|
||||
|
|
@ -91,13 +92,13 @@ out:
|
|||
}
|
||||
EXPORT_SYMBOL(vfs_fstatat);
|
||||
|
||||
int vfs_stat(char __user *name, struct kstat *stat)
|
||||
int vfs_stat(const char __user *name, struct kstat *stat)
|
||||
{
|
||||
return vfs_fstatat(AT_FDCWD, name, stat, 0);
|
||||
}
|
||||
EXPORT_SYMBOL(vfs_stat);
|
||||
|
||||
int vfs_lstat(char __user *name, struct kstat *stat)
|
||||
int vfs_lstat(const char __user *name, struct kstat *stat)
|
||||
{
|
||||
return vfs_fstatat(AT_FDCWD, name, stat, AT_SYMLINK_NOFOLLOW);
|
||||
}
|
||||
|
|
@ -147,7 +148,8 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * sta
|
|||
return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE2(stat, char __user *, filename, struct __old_kernel_stat __user *, statbuf)
|
||||
SYSCALL_DEFINE2(stat, const char __user *, filename,
|
||||
struct __old_kernel_stat __user *, statbuf)
|
||||
{
|
||||
struct kstat stat;
|
||||
int error;
|
||||
|
|
@ -159,7 +161,8 @@ SYSCALL_DEFINE2(stat, char __user *, filename, struct __old_kernel_stat __user *
|
|||
return cp_old_stat(&stat, statbuf);
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE2(lstat, char __user *, filename, struct __old_kernel_stat __user *, statbuf)
|
||||
SYSCALL_DEFINE2(lstat, const char __user *, filename,
|
||||
struct __old_kernel_stat __user *, statbuf)
|
||||
{
|
||||
struct kstat stat;
|
||||
int error;
|
||||
|
|
@ -234,7 +237,8 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
|
|||
return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE2(newstat, char __user *, filename, struct stat __user *, statbuf)
|
||||
SYSCALL_DEFINE2(newstat, const char __user *, filename,
|
||||
struct stat __user *, statbuf)
|
||||
{
|
||||
struct kstat stat;
|
||||
int error = vfs_stat(filename, &stat);
|
||||
|
|
@ -244,7 +248,8 @@ SYSCALL_DEFINE2(newstat, char __user *, filename, struct stat __user *, statbuf)
|
|||
return cp_new_stat(&stat, statbuf);
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE2(newlstat, char __user *, filename, struct stat __user *, statbuf)
|
||||
SYSCALL_DEFINE2(newlstat, const char __user *, filename,
|
||||
struct stat __user *, statbuf)
|
||||
{
|
||||
struct kstat stat;
|
||||
int error;
|
||||
|
|
@ -257,7 +262,7 @@ SYSCALL_DEFINE2(newlstat, char __user *, filename, struct stat __user *, statbuf
|
|||
}
|
||||
|
||||
#if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT)
|
||||
SYSCALL_DEFINE4(newfstatat, int, dfd, char __user *, filename,
|
||||
SYSCALL_DEFINE4(newfstatat, int, dfd, const char __user *, filename,
|
||||
struct stat __user *, statbuf, int, flag)
|
||||
{
|
||||
struct kstat stat;
|
||||
|
|
@ -355,7 +360,8 @@ static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf)
|
|||
return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE2(stat64, char __user *, filename, struct stat64 __user *, statbuf)
|
||||
SYSCALL_DEFINE2(stat64, const char __user *, filename,
|
||||
struct stat64 __user *, statbuf)
|
||||
{
|
||||
struct kstat stat;
|
||||
int error = vfs_stat(filename, &stat);
|
||||
|
|
@ -366,7 +372,8 @@ SYSCALL_DEFINE2(stat64, char __user *, filename, struct stat64 __user *, statbuf
|
|||
return error;
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE2(lstat64, char __user *, filename, struct stat64 __user *, statbuf)
|
||||
SYSCALL_DEFINE2(lstat64, const char __user *, filename,
|
||||
struct stat64 __user *, statbuf)
|
||||
{
|
||||
struct kstat stat;
|
||||
int error = vfs_lstat(filename, &stat);
|
||||
|
|
@ -388,7 +395,7 @@ SYSCALL_DEFINE2(fstat64, unsigned long, fd, struct stat64 __user *, statbuf)
|
|||
return error;
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename,
|
||||
SYSCALL_DEFINE4(fstatat64, int, dfd, const char __user *, filename,
|
||||
struct stat64 __user *, statbuf, int, flag)
|
||||
{
|
||||
struct kstat stat;
|
||||
|
|
|
|||
Loading…
Reference in a new issue