From 25cd22cae57f570e7db933cd226ca09d395f0561 Mon Sep 17 00:00:00 2001 From: Linus Torvalds <torvalds@home.transmeta.com> Date: Wed, 9 Apr 2003 08:13:14 -0700 Subject: [PATCH] Annotate fs/stat.c with user pointer annotations. --- fs/stat.c | 30 +++++++++++++++--------------- include/linux/fs.h | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/fs/stat.c b/fs/stat.c index 113f7d0c2bc0..66ed3db3061f 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -56,7 +56,7 @@ int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) return 0; } -int vfs_stat(char *name, struct kstat *stat) +int vfs_stat(char __user *name, struct kstat *stat) { struct nameidata nd; int error; @@ -69,7 +69,7 @@ int vfs_stat(char *name, struct kstat *stat) return error; } -int vfs_lstat(char *name, struct kstat *stat) +int vfs_lstat(char __user *name, struct kstat *stat) { struct nameidata nd; int error; @@ -102,7 +102,7 @@ int vfs_fstat(unsigned int fd, struct kstat *stat) * For backward compatibility? Maybe this should be moved * into arch/i386 instead? */ -static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat * statbuf) +static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * statbuf) { static int warncount = 5; struct __old_kernel_stat tmp; @@ -134,7 +134,7 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat * statbuf) return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; } -asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf) +asmlinkage long sys_stat(char __user * filename, struct __old_kernel_stat __user * statbuf) { struct kstat stat; int error = vfs_stat(filename, &stat); @@ -144,7 +144,7 @@ asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf) return error; } -asmlinkage long sys_lstat(char * filename, struct __old_kernel_stat * statbuf) +asmlinkage long sys_lstat(char __user * filename, struct __old_kernel_stat __user * statbuf) { struct kstat stat; int error = vfs_lstat(filename, &stat); @@ -154,7 +154,7 @@ asmlinkage long sys_lstat(char * filename, struct __old_kernel_stat * statbuf) return error; } -asmlinkage long sys_fstat(unsigned int fd, struct __old_kernel_stat * statbuf) +asmlinkage long sys_fstat(unsigned int fd, struct __old_kernel_stat __user * statbuf) { struct kstat stat; int error = vfs_fstat(fd, &stat); @@ -167,7 +167,7 @@ asmlinkage long sys_fstat(unsigned int fd, struct __old_kernel_stat * statbuf) #endif -static int cp_new_stat(struct kstat *stat, struct stat *statbuf) +static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf) { struct stat tmp; @@ -197,7 +197,7 @@ static int cp_new_stat(struct kstat *stat, struct stat *statbuf) return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; } -asmlinkage long sys_newstat(char * filename, struct stat * statbuf) +asmlinkage long sys_newstat(char __user * filename, struct stat __user * statbuf) { struct kstat stat; int error = vfs_stat(filename, &stat); @@ -207,7 +207,7 @@ asmlinkage long sys_newstat(char * filename, struct stat * statbuf) return error; } -asmlinkage long sys_newlstat(char * filename, struct stat * statbuf) +asmlinkage long sys_newlstat(char __user * filename, struct stat __user * statbuf) { struct kstat stat; int error = vfs_lstat(filename, &stat); @@ -217,7 +217,7 @@ asmlinkage long sys_newlstat(char * filename, struct stat * statbuf) return error; } -asmlinkage long sys_newfstat(unsigned int fd, struct stat * statbuf) +asmlinkage long sys_newfstat(unsigned int fd, struct stat __user * statbuf) { struct kstat stat; int error = vfs_fstat(fd, &stat); @@ -228,7 +228,7 @@ asmlinkage long sys_newfstat(unsigned int fd, struct stat * statbuf) return error; } -asmlinkage long sys_readlink(const char * path, char * buf, int bufsiz) +asmlinkage long sys_readlink(const char __user * path, char __user * buf, int bufsiz) { struct nameidata nd; int error; @@ -257,7 +257,7 @@ asmlinkage long sys_readlink(const char * path, char * buf, int bufsiz) /* ---------- LFS-64 ----------- */ #if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips64) && !defined(__x86_64__) && !defined(CONFIG_ARCH_S390X) -static long cp_new_stat64(struct kstat *stat, struct stat64 *statbuf) +static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf) { struct stat64 tmp; @@ -284,7 +284,7 @@ static long cp_new_stat64(struct kstat *stat, struct stat64 *statbuf) return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; } -asmlinkage long sys_stat64(char * filename, struct stat64 * statbuf, long flags) +asmlinkage long sys_stat64(char __user * filename, struct stat64 __user * statbuf, long flags) { struct kstat stat; int error = vfs_stat(filename, &stat); @@ -294,7 +294,7 @@ asmlinkage long sys_stat64(char * filename, struct stat64 * statbuf, long flags) return error; } -asmlinkage long sys_lstat64(char * filename, struct stat64 * statbuf, long flags) +asmlinkage long sys_lstat64(char __user * filename, struct stat64 __user * statbuf, long flags) { struct kstat stat; int error = vfs_lstat(filename, &stat); @@ -304,7 +304,7 @@ asmlinkage long sys_lstat64(char * filename, struct stat64 * statbuf, long flags return error; } -asmlinkage long sys_fstat64(unsigned long fd, struct stat64 * statbuf, long flags) +asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf, long flags) { struct kstat stat; int error = vfs_fstat(fd, &stat); diff --git a/include/linux/fs.h b/include/linux/fs.h index 16ad733f58e4..223f7ebd6b80 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -738,7 +738,7 @@ struct inode_operations { int (*mknod) (struct inode *,struct dentry *,int,dev_t); int (*rename) (struct inode *, struct dentry *, struct inode *, struct dentry *); - int (*readlink) (struct dentry *, char *,int); + int (*readlink) (struct dentry *, char __user *,int); int (*follow_link) (struct dentry *, struct nameidata *); void (*truncate) (struct inode *); int (*permission) (struct inode *, int); -- 2.30.9