aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/Locking8
-rw-r--r--Documentation/filesystems/vfs.txt6
-rw-r--r--Makefile1
-rw-r--r--arch/alpha/kernel/osf_sys.c6
-rw-r--r--arch/alpha/kernel/process.c2
-rw-r--r--arch/arm/kernel/sys_arm.c4
-rw-r--r--arch/arm/kernel/sys_oabi-compat.c6
-rw-r--r--arch/avr32/include/asm/syscalls.h2
-rw-r--r--arch/avr32/kernel/process.c3
-rw-r--r--arch/blackfin/kernel/process.c2
-rw-r--r--arch/frv/kernel/process.c3
-rw-r--r--arch/h8300/kernel/process.c2
-rw-r--r--arch/ia64/include/asm/unistd.h2
-rw-r--r--arch/ia64/kernel/process.c2
-rw-r--r--arch/m32r/kernel/process.c3
-rw-r--r--arch/m68k/kernel/process.c2
-rw-r--r--arch/m68knommu/kernel/process.c2
-rw-r--r--arch/microblaze/kernel/sys_microblaze.c2
-rw-r--r--arch/mips/kernel/syscall.c2
-rw-r--r--arch/mn10300/kernel/process.c2
-rw-r--r--arch/parisc/hpux/fs.c7
-rw-r--r--arch/powerpc/kernel/process.c2
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c2
-rw-r--r--arch/s390/kernel/compat_linux.c10
-rw-r--r--arch/s390/kernel/compat_linux.h10
-rw-r--r--arch/s390/kernel/entry.h2
-rw-r--r--arch/s390/kernel/process.c2
-rw-r--r--arch/sh/include/asm/syscalls_32.h2
-rw-r--r--arch/sh/include/asm/syscalls_64.h2
-rw-r--r--arch/sh/kernel/process_64.c2
-rw-r--r--arch/sparc/kernel/sys_sparc32.c7
-rw-r--r--arch/um/kernel/exec.c6
-rw-r--r--arch/um/kernel/internal.h2
-rw-r--r--arch/um/kernel/syscall.c2
-rw-r--r--arch/x86/ia32/sys_ia32.c14
-rw-r--r--arch/x86/include/asm/sys_ia32.h12
-rw-r--r--arch/x86/include/asm/syscalls.h2
-rw-r--r--arch/x86/kernel/entry_64.S4
-rw-r--r--arch/x86/kernel/process.c2
-rw-r--r--arch/xtensa/kernel/process.c2
-rw-r--r--drivers/input/joystick/amijoy.c2
-rw-r--r--drivers/input/keyboard/hil_kbd.c4
-rw-r--r--drivers/media/video/v4l2-compat-ioctl32.c7
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c2
-rw-r--r--fs/bad_inode.c7
-rw-r--r--fs/compat.c23
-rw-r--r--fs/compat_ioctl.c3
-rw-r--r--fs/ioctl.c18
-rw-r--r--fs/logfs/dir.c2
-rw-r--r--fs/logfs/file.c6
-rw-r--r--fs/logfs/logfs.h3
-rw-r--r--fs/proc/inode.c17
-rw-r--r--fs/stat.c29
-rw-r--r--fs/utimes.c7
-rw-r--r--include/linux/compat.h6
-rw-r--r--include/linux/dma-mapping.h2
-rw-r--r--include/linux/fs.h11
-rw-r--r--include/linux/syscalls.h20
-rw-r--r--include/linux/time.h2
-rw-r--r--kernel/time/timekeeping.c7
-rw-r--r--mm/nommu.c5
-rw-r--r--scripts/kconfig/conf.c15
-rw-r--r--scripts/kconfig/confdata.c111
-rw-r--r--scripts/kconfig/expr.c2
-rw-r--r--scripts/kconfig/lkc.h10
-rw-r--r--scripts/kconfig/nconf.c2
-rwxr-xr-xscripts/setlocalversion2
67 files changed, 252 insertions, 229 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index bbcc15651a21..2db4283efa8d 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -374,8 +374,6 @@ prototypes:
374 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 374 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
375 int (*readdir) (struct file *, void *, filldir_t); 375 int (*readdir) (struct file *, void *, filldir_t);
376 unsigned int (*poll) (struct file *, struct poll_table_struct *); 376 unsigned int (*poll) (struct file *, struct poll_table_struct *);
377 int (*ioctl) (struct inode *, struct file *, unsigned int,
378 unsigned long);
379 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 377 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
380 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 378 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
381 int (*mmap) (struct file *, struct vm_area_struct *); 379 int (*mmap) (struct file *, struct vm_area_struct *);
@@ -409,8 +407,7 @@ write: no
409aio_write: no 407aio_write: no
410readdir: no 408readdir: no
411poll: no 409poll: no
412ioctl: yes (see below) 410unlocked_ioctl: no
413unlocked_ioctl: no (see below)
414compat_ioctl: no 411compat_ioctl: no
415mmap: no 412mmap: no
416open: no 413open: no
@@ -453,9 +450,6 @@ move ->readdir() to inode_operations and use a separate method for directory
453anything that resembles union-mount we won't have a struct file for all 450anything that resembles union-mount we won't have a struct file for all
454components. And there are other reasons why the current interface is a mess... 451components. And there are other reasons why the current interface is a mess...
455 452
456->ioctl() on regular files is superceded by the ->unlocked_ioctl() that
457doesn't take the BKL.
458
459->read on directories probably must go away - we should just enforce -EISDIR 453->read on directories probably must go away - we should just enforce -EISDIR
460in sys_read() and friends. 454in sys_read() and friends.
461 455
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 94677e7dcb13..ed7e5efc06d8 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -727,7 +727,6 @@ struct file_operations {
727 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 727 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
728 int (*readdir) (struct file *, void *, filldir_t); 728 int (*readdir) (struct file *, void *, filldir_t);
729 unsigned int (*poll) (struct file *, struct poll_table_struct *); 729 unsigned int (*poll) (struct file *, struct poll_table_struct *);
730 int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
731 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 730 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
732 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 731 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
733 int (*mmap) (struct file *, struct vm_area_struct *); 732 int (*mmap) (struct file *, struct vm_area_struct *);
@@ -768,10 +767,7 @@ otherwise noted.
768 activity on this file and (optionally) go to sleep until there 767 activity on this file and (optionally) go to sleep until there
769 is activity. Called by the select(2) and poll(2) system calls 768 is activity. Called by the select(2) and poll(2) system calls
770 769
771 ioctl: called by the ioctl(2) system call 770 unlocked_ioctl: called by the ioctl(2) system call.
772
773 unlocked_ioctl: called by the ioctl(2) system call. Filesystems that do not
774 require the BKL should use this method instead of the ioctl() above.
775 771
776 compat_ioctl: called by the ioctl(2) system call when 32 bit system calls 772 compat_ioctl: called by the ioctl(2) system call when 32 bit system calls
777 are used on 64 bit kernels. 773 are used on 64 bit kernels.
diff --git a/Makefile b/Makefile
index 7431c283f15b..788111d21559 100644
--- a/Makefile
+++ b/Makefile
@@ -189,7 +189,6 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
189# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile 189# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
190export KBUILD_BUILDHOST := $(SUBARCH) 190export KBUILD_BUILDHOST := $(SUBARCH)
191ARCH ?= $(SUBARCH) 191ARCH ?= $(SUBARCH)
192CROSS_COMPILE ?=
193CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%) 192CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
194 193
195# Architecture as present in compile.h 194# Architecture as present in compile.h
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 88131c6e42e3..fb58150a7e8f 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -244,7 +244,7 @@ do_osf_statfs(struct path *path, struct osf_statfs __user *buffer,
244 return error; 244 return error;
245} 245}
246 246
247SYSCALL_DEFINE3(osf_statfs, char __user *, pathname, 247SYSCALL_DEFINE3(osf_statfs, const char __user *, pathname,
248 struct osf_statfs __user *, buffer, unsigned long, bufsiz) 248 struct osf_statfs __user *, buffer, unsigned long, bufsiz)
249{ 249{
250 struct path path; 250 struct path path;
@@ -358,7 +358,7 @@ osf_procfs_mount(char *dirname, struct procfs_args __user *args, int flags)
358 return do_mount("", dirname, "proc", flags, NULL); 358 return do_mount("", dirname, "proc", flags, NULL);
359} 359}
360 360
361SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, char __user *, path, 361SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
362 int, flag, void __user *, data) 362 int, flag, void __user *, data)
363{ 363{
364 int retval; 364 int retval;
@@ -932,7 +932,7 @@ SYSCALL_DEFINE3(osf_setitimer, int, which, struct itimerval32 __user *, in,
932 932
933} 933}
934 934
935SYSCALL_DEFINE2(osf_utimes, char __user *, filename, 935SYSCALL_DEFINE2(osf_utimes, const char __user *, filename,
936 struct timeval32 __user *, tvs) 936 struct timeval32 __user *, tvs)
937{ 937{
938 struct timespec tv[2]; 938 struct timespec tv[2];
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 395a464353b8..88e608aebc8c 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -387,7 +387,7 @@ EXPORT_SYMBOL(dump_elf_task_fp);
387 * sys_execve() executes a new program. 387 * sys_execve() executes a new program.
388 */ 388 */
389asmlinkage int 389asmlinkage int
390do_sys_execve(char __user *ufilename, char __user * __user *argv, 390do_sys_execve(const char __user *ufilename, char __user * __user *argv,
391 char __user * __user *envp, struct pt_regs *regs) 391 char __user * __user *envp, struct pt_regs *regs)
392{ 392{
393 int error; 393 int error;
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index c23501842b98..5b7c541a4c63 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -62,7 +62,7 @@ asmlinkage int sys_vfork(struct pt_regs *regs)
62/* sys_execve() executes a new program. 62/* sys_execve() executes a new program.
63 * This is called indirectly via a small wrapper 63 * This is called indirectly via a small wrapper
64 */ 64 */
65asmlinkage int sys_execve(char __user *filenamei, char __user * __user *argv, 65asmlinkage int sys_execve(const char __user *filenamei, char __user * __user *argv,
66 char __user * __user *envp, struct pt_regs *regs) 66 char __user * __user *envp, struct pt_regs *regs)
67{ 67{
68 int error; 68 int error;
@@ -84,7 +84,7 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
84 int ret; 84 int ret;
85 85
86 memset(&regs, 0, sizeof(struct pt_regs)); 86 memset(&regs, 0, sizeof(struct pt_regs));
87 ret = do_execve((char *)filename, (char __user * __user *)argv, 87 ret = do_execve(filename, (char __user * __user *)argv,
88 (char __user * __user *)envp, &regs); 88 (char __user * __user *)envp, &regs);
89 if (ret < 0) 89 if (ret < 0)
90 goto out; 90 goto out;
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
index 33ff678e32f2..4ad8da15ef2b 100644
--- a/arch/arm/kernel/sys_oabi-compat.c
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -141,7 +141,7 @@ static long cp_oldabi_stat64(struct kstat *stat,
141 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 141 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
142} 142}
143 143
144asmlinkage long sys_oabi_stat64(char __user * filename, 144asmlinkage long sys_oabi_stat64(const char __user * filename,
145 struct oldabi_stat64 __user * statbuf) 145 struct oldabi_stat64 __user * statbuf)
146{ 146{
147 struct kstat stat; 147 struct kstat stat;
@@ -151,7 +151,7 @@ asmlinkage long sys_oabi_stat64(char __user * filename,
151 return error; 151 return error;
152} 152}
153 153
154asmlinkage long sys_oabi_lstat64(char __user * filename, 154asmlinkage long sys_oabi_lstat64(const char __user * filename,
155 struct oldabi_stat64 __user * statbuf) 155 struct oldabi_stat64 __user * statbuf)
156{ 156{
157 struct kstat stat; 157 struct kstat stat;
@@ -172,7 +172,7 @@ asmlinkage long sys_oabi_fstat64(unsigned long fd,
172} 172}
173 173
174asmlinkage long sys_oabi_fstatat64(int dfd, 174asmlinkage long sys_oabi_fstatat64(int dfd,
175 char __user *filename, 175 const char __user *filename,
176 struct oldabi_stat64 __user *statbuf, 176 struct oldabi_stat64 __user *statbuf,
177 int flag) 177 int flag)
178{ 178{
diff --git a/arch/avr32/include/asm/syscalls.h b/arch/avr32/include/asm/syscalls.h
index 66a197266637..ab608b70b24d 100644
--- a/arch/avr32/include/asm/syscalls.h
+++ b/arch/avr32/include/asm/syscalls.h
@@ -21,7 +21,7 @@ asmlinkage int sys_clone(unsigned long, unsigned long,
21 unsigned long, unsigned long, 21 unsigned long, unsigned long,
22 struct pt_regs *); 22 struct pt_regs *);
23asmlinkage int sys_vfork(struct pt_regs *); 23asmlinkage int sys_vfork(struct pt_regs *);
24asmlinkage int sys_execve(char __user *, char __user *__user *, 24asmlinkage int sys_execve(const char __user *, char __user *__user *,
25 char __user *__user *, struct pt_regs *); 25 char __user *__user *, struct pt_regs *);
26 26
27/* kernel/signal.c */ 27/* kernel/signal.c */
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index 2d76515745a4..e5daddff397d 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -383,7 +383,8 @@ asmlinkage int sys_vfork(struct pt_regs *regs)
383 0, NULL, NULL); 383 0, NULL, NULL);
384} 384}
385 385
386asmlinkage int sys_execve(char __user *ufilename, char __user *__user *uargv, 386asmlinkage int sys_execve(const char __user *ufilename,
387 char __user *__user *uargv,
387 char __user *__user *uenvp, struct pt_regs *regs) 388 char __user *__user *uenvp, struct pt_regs *regs)
388{ 389{
389 int error; 390 int error;
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 93ec07da2e51..a566f61c002a 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -209,7 +209,7 @@ copy_thread(unsigned long clone_flags,
209/* 209/*
210 * sys_execve() executes a new program. 210 * sys_execve() executes a new program.
211 */ 211 */
212asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp) 212asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp)
213{ 213{
214 int error; 214 int error;
215 char *filename; 215 char *filename;
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 21d0fd19276d..428931cf2f0c 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -250,7 +250,8 @@ int copy_thread(unsigned long clone_flags,
250/* 250/*
251 * sys_execve() executes a new program. 251 * sys_execve() executes a new program.
252 */ 252 */
253asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp) 253asmlinkage int sys_execve(const char __user *name, char __user * __user *argv,
254 char __user * __user *envp)
254{ 255{
255 int error; 256 int error;
256 char * filename; 257 char * filename;
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
index 8c8b0ffa6ad7..8b7b78d77d5c 100644
--- a/arch/h8300/kernel/process.c
+++ b/arch/h8300/kernel/process.c
@@ -212,7 +212,7 @@ int copy_thread(unsigned long clone_flags,
212/* 212/*
213 * sys_execve() executes a new program. 213 * sys_execve() executes a new program.
214 */ 214 */
215asmlinkage int sys_execve(char *name, char **argv, char **envp,int dummy,...) 215asmlinkage int sys_execve(const char *name, char **argv, char **envp,int dummy,...)
216{ 216{
217 int error; 217 int error;
218 char * filename; 218 char * filename;
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index bb8b0fff32b3..46f36fc5125f 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -353,7 +353,7 @@ asmlinkage unsigned long sys_mmap2(
353 int fd, long pgoff); 353 int fd, long pgoff);
354struct pt_regs; 354struct pt_regs;
355struct sigaction; 355struct sigaction;
356long sys_execve(char __user *filename, char __user * __user *argv, 356long sys_execve(const char __user *filename, char __user * __user *argv,
357 char __user * __user *envp, struct pt_regs *regs); 357 char __user * __user *envp, struct pt_regs *regs);
358asmlinkage long sys_ia64_pipe(void); 358asmlinkage long sys_ia64_pipe(void);
359asmlinkage long sys_rt_sigaction(int sig, 359asmlinkage long sys_rt_sigaction(int sig,
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 53f1648c8b81..a879c03b7f1c 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -633,7 +633,7 @@ dump_fpu (struct pt_regs *pt, elf_fpregset_t dst)
633} 633}
634 634
635long 635long
636sys_execve (char __user *filename, char __user * __user *argv, char __user * __user *envp, 636sys_execve (const char __user *filename, char __user * __user *argv, char __user * __user *envp,
637 struct pt_regs *regs) 637 struct pt_regs *regs)
638{ 638{
639 char *fname; 639 char *fname;
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
index bc8c8c1511b2..8665a4d868ec 100644
--- a/arch/m32r/kernel/process.c
+++ b/arch/m32r/kernel/process.c
@@ -288,7 +288,8 @@ asmlinkage int sys_vfork(unsigned long r0, unsigned long r1, unsigned long r2,
288/* 288/*
289 * sys_execve() executes a new program. 289 * sys_execve() executes a new program.
290 */ 290 */
291asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv, 291asmlinkage int sys_execve(const char __user *ufilename,
292 char __user * __user *uargv,
292 char __user * __user *uenvp, 293 char __user * __user *uenvp,
293 unsigned long r3, unsigned long r4, unsigned long r5, 294 unsigned long r3, unsigned long r4, unsigned long r5,
294 unsigned long r6, struct pt_regs regs) 295 unsigned long r6, struct pt_regs regs)
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index 1a6be27cf165..221d0b71ce39 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -315,7 +315,7 @@ EXPORT_SYMBOL(dump_fpu);
315/* 315/*
316 * sys_execve() executes a new program. 316 * sys_execve() executes a new program.
317 */ 317 */
318asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp) 318asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp)
319{ 319{
320 int error; 320 int error;
321 char * filename; 321 char * filename;
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
index 6aa66134b433..6350f68cd026 100644
--- a/arch/m68knommu/kernel/process.c
+++ b/arch/m68knommu/kernel/process.c
@@ -350,7 +350,7 @@ void dump(struct pt_regs *fp)
350/* 350/*
351 * sys_execve() executes a new program. 351 * sys_execve() executes a new program.
352 */ 352 */
353asmlinkage int sys_execve(char *name, char **argv, char **envp) 353asmlinkage int sys_execve(const char *name, char **argv, char **envp)
354{ 354{
355 int error; 355 int error;
356 char * filename; 356 char * filename;
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
index f4e00b7f1259..6abab6ebedbe 100644
--- a/arch/microblaze/kernel/sys_microblaze.c
+++ b/arch/microblaze/kernel/sys_microblaze.c
@@ -47,7 +47,7 @@ asmlinkage long microblaze_clone(int flags, unsigned long stack, struct pt_regs
47 return do_fork(flags, stack, regs, 0, NULL, NULL); 47 return do_fork(flags, stack, regs, 0, NULL, NULL);
48} 48}
49 49
50asmlinkage long microblaze_execve(char __user *filenamei, char __user *__user *argv, 50asmlinkage long microblaze_execve(const char __user *filenamei, char __user *__user *argv,
51 char __user *__user *envp, struct pt_regs *regs) 51 char __user *__user *envp, struct pt_regs *regs)
52{ 52{
53 int error; 53 int error;
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 58bab2ef257f..bddce0bca195 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -254,7 +254,7 @@ asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs)
254 int error; 254 int error;
255 char * filename; 255 char * filename;
256 256
257 filename = getname((char __user *) (long)regs.regs[4]); 257 filename = getname((const char __user *) (long)regs.regs[4]);
258 error = PTR_ERR(filename); 258 error = PTR_ERR(filename);
259 if (IS_ERR(filename)) 259 if (IS_ERR(filename))
260 goto out; 260 goto out;
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
index 82b817c7f7b6..762eb325b949 100644
--- a/arch/mn10300/kernel/process.c
+++ b/arch/mn10300/kernel/process.c
@@ -268,7 +268,7 @@ asmlinkage long sys_vfork(void)
268 0, NULL, NULL); 268 0, NULL, NULL);
269} 269}
270 270
271asmlinkage long sys_execve(char __user *name, 271asmlinkage long sys_execve(const char __user *name,
272 char __user * __user *argv, 272 char __user * __user *argv,
273 char __user * __user *envp) 273 char __user * __user *envp)
274{ 274{
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c
index 6935123178eb..1444875a7611 100644
--- a/arch/parisc/hpux/fs.c
+++ b/arch/parisc/hpux/fs.c
@@ -36,7 +36,7 @@ int hpux_execve(struct pt_regs *regs)
36 int error; 36 int error;
37 char *filename; 37 char *filename;
38 38
39 filename = getname((char __user *) regs->gr[26]); 39 filename = getname((const char __user *) regs->gr[26]);
40 error = PTR_ERR(filename); 40 error = PTR_ERR(filename);
41 if (IS_ERR(filename)) 41 if (IS_ERR(filename))
42 goto out; 42 goto out;
@@ -169,7 +169,7 @@ static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 __user *statbuf)
169 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 169 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
170} 170}
171 171
172long hpux_stat64(char __user *filename, struct hpux_stat64 __user *statbuf) 172long hpux_stat64(const char __user *filename, struct hpux_stat64 __user *statbuf)
173{ 173{
174 struct kstat stat; 174 struct kstat stat;
175 int error = vfs_stat(filename, &stat); 175 int error = vfs_stat(filename, &stat);
@@ -191,7 +191,8 @@ long hpux_fstat64(unsigned int fd, struct hpux_stat64 __user *statbuf)
191 return error; 191 return error;
192} 192}
193 193
194long hpux_lstat64(char __user *filename, struct hpux_stat64 __user *statbuf) 194long hpux_lstat64(const char __user *filename,
195 struct hpux_stat64 __user *statbuf)
195{ 196{
196 struct kstat stat; 197 struct kstat stat;
197 int error = vfs_lstat(filename, &stat); 198 int error = vfs_lstat(filename, &stat);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index e78a5add7f15..feacfb789686 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1027,7 +1027,7 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
1027 int error; 1027 int error;
1028 char *filename; 1028 char *filename;
1029 1029
1030 filename = getname((char __user *) a0); 1030 filename = getname((const char __user *) a0);
1031 error = PTR_ERR(filename); 1031 error = PTR_ERR(filename);
1032 if (IS_ERR(filename)) 1032 if (IS_ERR(filename))
1033 goto out; 1033 goto out;
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 19471a1cef1a..20fd701a686a 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -546,7 +546,7 @@ compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_siz
546 return sys_pread64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo); 546 return sys_pread64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo);
547} 547}
548 548
549compat_ssize_t compat_sys_pwrite64(unsigned int fd, char __user *ubuf, compat_size_t count, 549compat_ssize_t compat_sys_pwrite64(unsigned int fd, const char __user *ubuf, compat_size_t count,
550 u32 reg6, u32 poshi, u32 poslo) 550 u32 reg6, u32 poshi, u32 poslo)
551{ 551{
552 return sys_pwrite64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo); 552 return sys_pwrite64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo);
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 73b624ed9cd8..1e6449c79ab6 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -436,7 +436,7 @@ sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
436 * sys32_execve() executes a new program after the asm stub has set 436 * sys32_execve() executes a new program after the asm stub has set
437 * things up for us. This should basically do what I want it to. 437 * things up for us. This should basically do what I want it to.
438 */ 438 */
439asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv, 439asmlinkage long sys32_execve(const char __user *name, compat_uptr_t __user *argv,
440 compat_uptr_t __user *envp) 440 compat_uptr_t __user *envp)
441{ 441{
442 struct pt_regs *regs = task_pt_regs(current); 442 struct pt_regs *regs = task_pt_regs(current);
@@ -570,7 +570,7 @@ static int cp_stat64(struct stat64_emu31 __user *ubuf, struct kstat *stat)
570 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 570 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
571} 571}
572 572
573asmlinkage long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf) 573asmlinkage long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf)
574{ 574{
575 struct kstat stat; 575 struct kstat stat;
576 int ret = vfs_stat(filename, &stat); 576 int ret = vfs_stat(filename, &stat);
@@ -579,7 +579,7 @@ asmlinkage long sys32_stat64(char __user * filename, struct stat64_emu31 __user
579 return ret; 579 return ret;
580} 580}
581 581
582asmlinkage long sys32_lstat64(char __user * filename, struct stat64_emu31 __user * statbuf) 582asmlinkage long sys32_lstat64(const char __user * filename, struct stat64_emu31 __user * statbuf)
583{ 583{
584 struct kstat stat; 584 struct kstat stat;
585 int ret = vfs_lstat(filename, &stat); 585 int ret = vfs_lstat(filename, &stat);
@@ -597,7 +597,7 @@ asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * sta
597 return ret; 597 return ret;
598} 598}
599 599
600asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename, 600asmlinkage long sys32_fstatat64(unsigned int dfd, const char __user *filename,
601 struct stat64_emu31 __user* statbuf, int flag) 601 struct stat64_emu31 __user* statbuf, int flag)
602{ 602{
603 struct kstat stat; 603 struct kstat stat;
@@ -655,7 +655,7 @@ asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
655 return sys_read(fd, buf, count); 655 return sys_read(fd, buf, count);
656} 656}
657 657
658asmlinkage long sys32_write(unsigned int fd, char __user * buf, size_t count) 658asmlinkage long sys32_write(unsigned int fd, const char __user * buf, size_t count)
659{ 659{
660 if ((compat_ssize_t) count < 0) 660 if ((compat_ssize_t) count < 0)
661 return -EINVAL; 661 return -EINVAL;
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index cb97afc85c94..9635d759c2b9 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -193,7 +193,7 @@ long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
193 compat_sigset_t __user *oset, size_t sigsetsize); 193 compat_sigset_t __user *oset, size_t sigsetsize);
194long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize); 194long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize);
195long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo); 195long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo);
196long sys32_execve(char __user *name, compat_uptr_t __user *argv, 196long sys32_execve(const char __user *name, compat_uptr_t __user *argv,
197 compat_uptr_t __user *envp); 197 compat_uptr_t __user *envp);
198long sys32_init_module(void __user *umod, unsigned long len, 198long sys32_init_module(void __user *umod, unsigned long len,
199 const char __user *uargs); 199 const char __user *uargs);
@@ -207,16 +207,16 @@ long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
207 size_t count); 207 size_t count);
208long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, 208long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset,
209 s32 count); 209 s32 count);
210long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf); 210long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf);
211long sys32_lstat64(char __user * filename, 211long sys32_lstat64(const char __user * filename,
212 struct stat64_emu31 __user * statbuf); 212 struct stat64_emu31 __user * statbuf);
213long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf); 213long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf);
214long sys32_fstatat64(unsigned int dfd, char __user *filename, 214long sys32_fstatat64(unsigned int dfd, const char __user *filename,
215 struct stat64_emu31 __user* statbuf, int flag); 215 struct stat64_emu31 __user* statbuf, int flag);
216unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg); 216unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg);
217long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg); 217long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg);
218long sys32_read(unsigned int fd, char __user * buf, size_t count); 218long sys32_read(unsigned int fd, char __user * buf, size_t count);
219long sys32_write(unsigned int fd, char __user * buf, size_t count); 219long sys32_write(unsigned int fd, const char __user * buf, size_t count);
220long sys32_fadvise64(int fd, loff_t offset, size_t len, int advise); 220long sys32_fadvise64(int fd, loff_t offset, size_t len, int advise);
221long sys32_fadvise64_64(struct fadvise64_64_args __user *args); 221long sys32_fadvise64_64(struct fadvise64_64_args __user *args);
222long sys32_sigaction(int sig, const struct old_sigaction32 __user *act, 222long sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index 5bb1e6b5db26..403fb430a896 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -42,7 +42,7 @@ long sys_clone(unsigned long newsp, unsigned long clone_flags,
42 int __user *parent_tidptr, int __user *child_tidptr); 42 int __user *parent_tidptr, int __user *child_tidptr);
43long sys_vfork(void); 43long sys_vfork(void);
44void execve_tail(void); 44void execve_tail(void);
45long sys_execve(char __user *name, char __user * __user *argv, 45long sys_execve(const char __user *name, char __user * __user *argv,
46 char __user * __user *envp); 46 char __user * __user *envp);
47long sys_sigsuspend(int history0, int history1, old_sigset_t mask); 47long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
48long sys_sigaction(int sig, const struct old_sigaction __user *act, 48long sys_sigaction(int sig, const struct old_sigaction __user *act,
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 1039fdea15b5..7eafaf2662b9 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -267,7 +267,7 @@ asmlinkage void execve_tail(void)
267/* 267/*
268 * sys_execve() executes a new program. 268 * sys_execve() executes a new program.
269 */ 269 */
270SYSCALL_DEFINE3(execve, char __user *, name, char __user * __user *, argv, 270SYSCALL_DEFINE3(execve, const char __user *, name, char __user * __user *, argv,
271 char __user * __user *, envp) 271 char __user * __user *, envp)
272{ 272{
273 struct pt_regs *regs = task_pt_regs(current); 273 struct pt_regs *regs = task_pt_regs(current);
diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h
index 8b30200305c3..be201fdc97aa 100644
--- a/arch/sh/include/asm/syscalls_32.h
+++ b/arch/sh/include/asm/syscalls_32.h
@@ -19,7 +19,7 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
19asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, 19asmlinkage int sys_vfork(unsigned long r4, unsigned long r5,
20 unsigned long r6, unsigned long r7, 20 unsigned long r6, unsigned long r7,
21 struct pt_regs __regs); 21 struct pt_regs __regs);
22asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv, 22asmlinkage int sys_execve(const char __user *ufilename, char __user * __user *uargv,
23 char __user * __user *uenvp, unsigned long r7, 23 char __user * __user *uenvp, unsigned long r7,
24 struct pt_regs __regs); 24 struct pt_regs __regs);
25asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r5, 25asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r5,
diff --git a/arch/sh/include/asm/syscalls_64.h b/arch/sh/include/asm/syscalls_64.h
index 751fd8811364..ee519f41d950 100644
--- a/arch/sh/include/asm/syscalls_64.h
+++ b/arch/sh/include/asm/syscalls_64.h
@@ -21,7 +21,7 @@ asmlinkage int sys_vfork(unsigned long r2, unsigned long r3,
21 unsigned long r4, unsigned long r5, 21 unsigned long r4, unsigned long r5,
22 unsigned long r6, unsigned long r7, 22 unsigned long r6, unsigned long r7,
23 struct pt_regs *pregs); 23 struct pt_regs *pregs);
24asmlinkage int sys_execve(char *ufilename, char **uargv, 24asmlinkage int sys_execve(const char *ufilename, char **uargv,
25 char **uenvp, unsigned long r5, 25 char **uenvp, unsigned long r5,
26 unsigned long r6, unsigned long r7, 26 unsigned long r6, unsigned long r7,
27 struct pt_regs *pregs); 27 struct pt_regs *pregs);
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c
index d4ca6480e355..68d128d651b3 100644
--- a/arch/sh/kernel/process_64.c
+++ b/arch/sh/kernel/process_64.c
@@ -483,7 +483,7 @@ asmlinkage int sys_vfork(unsigned long r2, unsigned long r3,
483/* 483/*
484 * sys_execve() executes a new program. 484 * sys_execve() executes a new program.
485 */ 485 */
486asmlinkage int sys_execve(char *ufilename, char **uargv, 486asmlinkage int sys_execve(const char *ufilename, char **uargv,
487 char **uenvp, unsigned long r5, 487 char **uenvp, unsigned long r5,
488 unsigned long r6, unsigned long r7, 488 unsigned long r6, unsigned long r7,
489 struct pt_regs *pregs) 489 struct pt_regs *pregs)
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index c0ca87553e1c..e6375a750d9a 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -162,7 +162,7 @@ static int cp_compat_stat64(struct kstat *stat,
162 return err; 162 return err;
163} 163}
164 164
165asmlinkage long compat_sys_stat64(char __user * filename, 165asmlinkage long compat_sys_stat64(const char __user * filename,
166 struct compat_stat64 __user *statbuf) 166 struct compat_stat64 __user *statbuf)
167{ 167{
168 struct kstat stat; 168 struct kstat stat;
@@ -173,7 +173,7 @@ asmlinkage long compat_sys_stat64(char __user * filename,
173 return error; 173 return error;
174} 174}
175 175
176asmlinkage long compat_sys_lstat64(char __user * filename, 176asmlinkage long compat_sys_lstat64(const char __user * filename,
177 struct compat_stat64 __user *statbuf) 177 struct compat_stat64 __user *statbuf)
178{ 178{
179 struct kstat stat; 179 struct kstat stat;
@@ -195,7 +195,8 @@ asmlinkage long compat_sys_fstat64(unsigned int fd,
195 return error; 195 return error;
196} 196}
197 197
198asmlinkage long compat_sys_fstatat64(unsigned int dfd, char __user *filename, 198asmlinkage long compat_sys_fstatat64(unsigned int dfd,
199 const char __user *filename,
199 struct compat_stat64 __user * statbuf, int flag) 200 struct compat_stat64 __user * statbuf, int flag)
200{ 201{
201 struct kstat stat; 202 struct kstat stat;
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c
index 97974c1bdd12..59b20d93b6d4 100644
--- a/arch/um/kernel/exec.c
+++ b/arch/um/kernel/exec.c
@@ -44,7 +44,7 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
44 PT_REGS_SP(regs) = esp; 44 PT_REGS_SP(regs) = esp;
45} 45}
46 46
47static long execve1(char *file, char __user * __user *argv, 47static long execve1(const char *file, char __user * __user *argv,
48 char __user *__user *env) 48 char __user *__user *env)
49{ 49{
50 long error; 50 long error;
@@ -61,7 +61,7 @@ static long execve1(char *file, char __user * __user *argv,
61 return error; 61 return error;
62} 62}
63 63
64long um_execve(char *file, char __user *__user *argv, char __user *__user *env) 64long um_execve(const char *file, char __user *__user *argv, char __user *__user *env)
65{ 65{
66 long err; 66 long err;
67 67
@@ -71,7 +71,7 @@ long um_execve(char *file, char __user *__user *argv, char __user *__user *env)
71 return err; 71 return err;
72} 72}
73 73
74long sys_execve(char __user *file, char __user *__user *argv, 74long sys_execve(const char __user *file, char __user *__user *argv,
75 char __user *__user *env) 75 char __user *__user *env)
76{ 76{
77 long error; 77 long error;
diff --git a/arch/um/kernel/internal.h b/arch/um/kernel/internal.h
index 3bda43c7a786..1303a105fe91 100644
--- a/arch/um/kernel/internal.h
+++ b/arch/um/kernel/internal.h
@@ -1 +1 @@
extern long um_execve(char *file, char __user *__user *argv, char __user *__user *env); extern long um_execve(const char *file, char __user *__user *argv, char __user *__user *env);
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index 4393173923f5..7427c0b1930c 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -58,7 +58,7 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
58 58
59 fs = get_fs(); 59 fs = get_fs();
60 set_fs(KERNEL_DS); 60 set_fs(KERNEL_DS);
61 ret = um_execve((char *)filename, (char __user *__user *)argv, 61 ret = um_execve(filename, (char __user *__user *)argv,
62 (char __user *__user *) envp); 62 (char __user *__user *) envp);
63 set_fs(fs); 63 set_fs(fs);
64 64
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index 3d093311d5e2..849813f398e7 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -51,7 +51,7 @@
51#define AA(__x) ((unsigned long)(__x)) 51#define AA(__x) ((unsigned long)(__x))
52 52
53 53
54asmlinkage long sys32_truncate64(char __user *filename, 54asmlinkage long sys32_truncate64(const char __user *filename,
55 unsigned long offset_low, 55 unsigned long offset_low,
56 unsigned long offset_high) 56 unsigned long offset_high)
57{ 57{
@@ -96,7 +96,7 @@ static int cp_stat64(struct stat64 __user *ubuf, struct kstat *stat)
96 return 0; 96 return 0;
97} 97}
98 98
99asmlinkage long sys32_stat64(char __user *filename, 99asmlinkage long sys32_stat64(const char __user *filename,
100 struct stat64 __user *statbuf) 100 struct stat64 __user *statbuf)
101{ 101{
102 struct kstat stat; 102 struct kstat stat;
@@ -107,7 +107,7 @@ asmlinkage long sys32_stat64(char __user *filename,
107 return ret; 107 return ret;
108} 108}
109 109
110asmlinkage long sys32_lstat64(char __user *filename, 110asmlinkage long sys32_lstat64(const char __user *filename,
111 struct stat64 __user *statbuf) 111 struct stat64 __user *statbuf)
112{ 112{
113 struct kstat stat; 113 struct kstat stat;
@@ -126,7 +126,7 @@ asmlinkage long sys32_fstat64(unsigned int fd, struct stat64 __user *statbuf)
126 return ret; 126 return ret;
127} 127}
128 128
129asmlinkage long sys32_fstatat(unsigned int dfd, char __user *filename, 129asmlinkage long sys32_fstatat(unsigned int dfd, const char __user *filename,
130 struct stat64 __user *statbuf, int flag) 130 struct stat64 __user *statbuf, int flag)
131{ 131{
132 struct kstat stat; 132 struct kstat stat;
@@ -408,8 +408,8 @@ asmlinkage long sys32_pread(unsigned int fd, char __user *ubuf, u32 count,
408 ((loff_t)AA(poshi) << 32) | AA(poslo)); 408 ((loff_t)AA(poshi) << 32) | AA(poslo));
409} 409}
410 410
411asmlinkage long sys32_pwrite(unsigned int fd, char __user *ubuf, u32 count, 411asmlinkage long sys32_pwrite(unsigned int fd, const char __user *ubuf,
412 u32 poslo, u32 poshi) 412 u32 count, u32 poslo, u32 poshi)
413{ 413{
414 return sys_pwrite64(fd, ubuf, count, 414 return sys_pwrite64(fd, ubuf, count,
415 ((loff_t)AA(poshi) << 32) | AA(poslo)); 415 ((loff_t)AA(poshi) << 32) | AA(poslo));
@@ -449,7 +449,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd,
449 return ret; 449 return ret;
450} 450}
451 451
452asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv, 452asmlinkage long sys32_execve(const char __user *name, compat_uptr_t __user *argv,
453 compat_uptr_t __user *envp, struct pt_regs *regs) 453 compat_uptr_t __user *envp, struct pt_regs *regs)
454{ 454{
455 long error; 455 long error;
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
index cf4e2e381cba..cb238526a9f1 100644
--- a/arch/x86/include/asm/sys_ia32.h
+++ b/arch/x86/include/asm/sys_ia32.h
@@ -18,13 +18,13 @@
18#include <asm/ia32.h> 18#include <asm/ia32.h>
19 19
20/* ia32/sys_ia32.c */ 20/* ia32/sys_ia32.c */
21asmlinkage long sys32_truncate64(char __user *, unsigned long, unsigned long); 21asmlinkage long sys32_truncate64(const char __user *, unsigned long, unsigned long);
22asmlinkage long sys32_ftruncate64(unsigned int, unsigned long, unsigned long); 22asmlinkage long sys32_ftruncate64(unsigned int, unsigned long, unsigned long);
23 23
24asmlinkage long sys32_stat64(char __user *, struct stat64 __user *); 24asmlinkage long sys32_stat64(const char __user *, struct stat64 __user *);
25asmlinkage long sys32_lstat64(char __user *, struct stat64 __user *); 25asmlinkage long sys32_lstat64(const char __user *, struct stat64 __user *);
26asmlinkage long sys32_fstat64(unsigned int, struct stat64 __user *); 26asmlinkage long sys32_fstat64(unsigned int, struct stat64 __user *);
27asmlinkage long sys32_fstatat(unsigned int, char __user *, 27asmlinkage long sys32_fstatat(unsigned int, const char __user *,
28 struct stat64 __user *, int); 28 struct stat64 __user *, int);
29struct mmap_arg_struct32; 29struct mmap_arg_struct32;
30asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *); 30asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *);
@@ -49,12 +49,12 @@ asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *, compat_size_t);
49asmlinkage long sys32_rt_sigqueueinfo(int, int, compat_siginfo_t __user *); 49asmlinkage long sys32_rt_sigqueueinfo(int, int, compat_siginfo_t __user *);
50 50
51asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32); 51asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32);
52asmlinkage long sys32_pwrite(unsigned int, char __user *, u32, u32, u32); 52asmlinkage long sys32_pwrite(unsigned int, const char __user *, u32, u32, u32);
53 53
54asmlinkage long sys32_personality(unsigned long); 54asmlinkage long sys32_personality(unsigned long);
55asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32); 55asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32);
56 56
57asmlinkage long sys32_execve(char __user *, compat_uptr_t __user *, 57asmlinkage long sys32_execve(const char __user *, compat_uptr_t __user *,
58 compat_uptr_t __user *, struct pt_regs *); 58 compat_uptr_t __user *, struct pt_regs *);
59asmlinkage long sys32_clone(unsigned int, unsigned int, struct pt_regs *); 59asmlinkage long sys32_clone(unsigned int, unsigned int, struct pt_regs *);
60 60
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index 5c044b43e9a7..feb2ff9bfc2d 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -23,7 +23,7 @@ long sys_iopl(unsigned int, struct pt_regs *);
23/* kernel/process.c */ 23/* kernel/process.c */
24int sys_fork(struct pt_regs *); 24int sys_fork(struct pt_regs *);
25int sys_vfork(struct pt_regs *); 25int sys_vfork(struct pt_regs *);
26long sys_execve(char __user *, char __user * __user *, 26long sys_execve(const char __user *, char __user * __user *,
27 char __user * __user *, struct pt_regs *); 27 char __user * __user *, struct pt_regs *);
28long sys_clone(unsigned long, unsigned long, void __user *, 28long sys_clone(unsigned long, unsigned long, void __user *,
29 void __user *, struct pt_regs *); 29 void __user *, struct pt_regs *);
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index c5ea5cdbe7b3..17be5ec7cbba 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1185,13 +1185,13 @@ END(kernel_thread_helper)
1185 * execve(). This function needs to use IRET, not SYSRET, to set up all state properly. 1185 * execve(). This function needs to use IRET, not SYSRET, to set up all state properly.
1186 * 1186 *
1187 * C extern interface: 1187 * C extern interface:
1188 * extern long execve(char *name, char **argv, char **envp) 1188 * extern long execve(const char *name, char **argv, char **envp)
1189 * 1189 *
1190 * asm input arguments: 1190 * asm input arguments:
1191 * rdi: name, rsi: argv, rdx: envp 1191 * rdi: name, rsi: argv, rdx: envp
1192 * 1192 *
1193 * We want to fallback into: 1193 * We want to fallback into:
1194 * extern long sys_execve(char *name, char **argv,char **envp, struct pt_regs *regs) 1194 * extern long sys_execve(const char *name, char **argv,char **envp, struct pt_regs *regs)
1195 * 1195 *
1196 * do_sys_execve asm fallback arguments: 1196 * do_sys_execve asm fallback arguments:
1197 * rdi: name, rsi: argv, rdx: envp, rcx: fake frame on the stack 1197 * rdi: name, rsi: argv, rdx: envp, rcx: fake frame on the stack
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index d401f1d2d06e..64ecaf0af9af 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -301,7 +301,7 @@ EXPORT_SYMBOL(kernel_thread);
301/* 301/*
302 * sys_execve() executes a new program. 302 * sys_execve() executes a new program.
303 */ 303 */
304long sys_execve(char __user *name, char __user * __user *argv, 304long sys_execve(const char __user *name, char __user * __user *argv,
305 char __user * __user *envp, struct pt_regs *regs) 305 char __user * __user *envp, struct pt_regs *regs)
306{ 306{
307 long error; 307 long error;
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index f167e0f5e05e..7c2f38f68ebb 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -318,7 +318,7 @@ long xtensa_clone(unsigned long clone_flags, unsigned long newsp,
318 */ 318 */
319 319
320asmlinkage 320asmlinkage
321long xtensa_execve(char __user *name, char __user * __user *argv, 321long xtensa_execve(const char __user *name, char __user * __user *argv,
322 char __user * __user *envp, 322 char __user * __user *envp,
323 long a3, long a4, long a5, 323 long a3, long a4, long a5,
324 struct pt_regs *regs) 324 struct pt_regs *regs)
diff --git a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c
index e90694fe0d5c..0bc86204213e 100644
--- a/drivers/input/joystick/amijoy.c
+++ b/drivers/input/joystick/amijoy.c
@@ -139,7 +139,7 @@ static int __init amijoy_init(void)
139 amijoy_dev[i]->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) | 139 amijoy_dev[i]->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
140 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); 140 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
141 for (j = 0; j < 2; j++) { 141 for (j = 0; j < 2; j++) {
142 XXinput_set_abs_params(amijoy_dev[i], ABS_X + j, 142 input_set_abs_params(amijoy_dev[i], ABS_X + j,
143 -1, 1, 0, 0); 143 -1, 1, 0, 0);
144 } 144 }
145 145
diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c
index ddd5afd301d4..dcc86b97a153 100644
--- a/drivers/input/keyboard/hil_kbd.c
+++ b/drivers/input/keyboard/hil_kbd.c
@@ -235,7 +235,7 @@ static void hil_dev_handle_ptr_events(struct hil_dev *ptr)
235 if (val < input_abs_min(dev, ABS_X + i)) 235 if (val < input_abs_min(dev, ABS_X + i))
236 input_abs_set_min(dev, ABS_X + i, val); 236 input_abs_set_min(dev, ABS_X + i, val);
237 if (val > input_abs_max(dev, ABS_X + i)) 237 if (val > input_abs_max(dev, ABS_X + i))
238 XXinput_abs_set_max(dev, ABS_X + i, val); 238 input_abs_set_max(dev, ABS_X + i, val);
239#endif 239#endif
240 if (i % 3) 240 if (i % 3)
241 val = input_abs_max(dev, ABS_X + i) - val; 241 val = input_abs_max(dev, ABS_X + i) - val;
@@ -391,7 +391,7 @@ static void hil_dev_pointer_setup(struct hil_dev *ptr)
391 int diff = input_abs_max(input_dev, ABS_X + i) / 10; 391 int diff = input_abs_max(input_dev, ABS_X + i) / 10;
392 input_abs_set_min(input_dev, ABS_X + i, 392 input_abs_set_min(input_dev, ABS_X + i,
393 input_abs_min(input_dev, ABS_X + i) + diff) 393 input_abs_min(input_dev, ABS_X + i) + diff)
394 XXinput_abs_set_max(input_dev, ABS_X + i, 394 input_abs_set_max(input_dev, ABS_X + i,
395 input_abs_max(input_dev, ABS_X + i) - diff) 395 input_abs_max(input_dev, ABS_X + i) - diff)
396 } 396 }
397#endif 397#endif
diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c
index d2f20c2acae2..073f01390cdd 100644
--- a/drivers/media/video/v4l2-compat-ioctl32.c
+++ b/drivers/media/video/v4l2-compat-ioctl32.c
@@ -228,11 +228,6 @@ static long native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
228 228
229 if (file->f_op->unlocked_ioctl) 229 if (file->f_op->unlocked_ioctl)
230 ret = file->f_op->unlocked_ioctl(file, cmd, arg); 230 ret = file->f_op->unlocked_ioctl(file, cmd, arg);
231 else if (file->f_op->ioctl) {
232 lock_kernel();
233 ret = file->f_op->ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
234 unlock_kernel();
235 }
236 231
237 return ret; 232 return ret;
238} 233}
@@ -973,7 +968,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
973{ 968{
974 long ret = -ENOIOCTLCMD; 969 long ret = -ENOIOCTLCMD;
975 970
976 if (!file->f_op->ioctl && !file->f_op->unlocked_ioctl) 971 if (!file->f_op->unlocked_ioctl)
977 return ret; 972 return ret;
978 973
979 switch (cmd) { 974 switch (cmd) {
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 4eb6f986703b..f5819526b5ee 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -808,6 +808,7 @@ xirc2ps_config(struct pcmcia_device * link)
808 } 808 }
809 809
810 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 810 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
811 link->io_lines = 10;
811 if (local->modem) { 812 if (local->modem) {
812 int pass; 813 int pass;
813 814
@@ -839,7 +840,6 @@ xirc2ps_config(struct pcmcia_device * link)
839 } 840 }
840 printk(KNOT_XIRC "no ports available\n"); 841 printk(KNOT_XIRC "no ports available\n");
841 } else { 842 } else {
842 link->io_lines = 10;
843 link->resource[0]->end = 16; 843 link->resource[0]->end = 16;
844 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 844 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
845 link->resource[0]->start = ioaddr; 845 link->resource[0]->start = ioaddr;
diff --git a/fs/bad_inode.c b/fs/bad_inode.c
index 52e59bf4aa5f..f024d8aaddef 100644
--- a/fs/bad_inode.c
+++ b/fs/bad_inode.c
@@ -55,12 +55,6 @@ static unsigned int bad_file_poll(struct file *filp, poll_table *wait)
55 return POLLERR; 55 return POLLERR;
56} 56}
57 57
58static int bad_file_ioctl (struct inode *inode, struct file *filp,
59 unsigned int cmd, unsigned long arg)
60{
61 return -EIO;
62}
63
64static long bad_file_unlocked_ioctl(struct file *file, unsigned cmd, 58static long bad_file_unlocked_ioctl(struct file *file, unsigned cmd,
65 unsigned long arg) 59 unsigned long arg)
66{ 60{
@@ -159,7 +153,6 @@ static const struct file_operations bad_file_ops =
159 .aio_write = bad_file_aio_write, 153 .aio_write = bad_file_aio_write,
160 .readdir = bad_file_readdir, 154 .readdir = bad_file_readdir,
161 .poll = bad_file_poll, 155 .poll = bad_file_poll,
162 .ioctl = bad_file_ioctl,
163 .unlocked_ioctl = bad_file_unlocked_ioctl, 156 .unlocked_ioctl = bad_file_unlocked_ioctl,
164 .compat_ioctl = bad_file_compat_ioctl, 157 .compat_ioctl = bad_file_compat_ioctl,
165 .mmap = bad_file_mmap, 158 .mmap = bad_file_mmap,
diff --git a/fs/compat.c b/fs/compat.c
index e6d5d70cf3cf..718c7062aec1 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -77,7 +77,8 @@ int compat_printk(const char *fmt, ...)
77 * Not all architectures have sys_utime, so implement this in terms 77 * Not all architectures have sys_utime, so implement this in terms
78 * of sys_utimes. 78 * of sys_utimes.
79 */ 79 */
80asmlinkage long compat_sys_utime(char __user *filename, struct compat_utimbuf __user *t) 80asmlinkage long compat_sys_utime(const char __user *filename,
81 struct compat_utimbuf __user *t)
81{ 82{
82 struct timespec tv[2]; 83 struct timespec tv[2];
83 84
@@ -91,7 +92,7 @@ asmlinkage long compat_sys_utime(char __user *filename, struct compat_utimbuf __
91 return do_utimes(AT_FDCWD, filename, t ? tv : NULL, 0); 92 return do_utimes(AT_FDCWD, filename, t ? tv : NULL, 0);
92} 93}
93 94
94asmlinkage long compat_sys_utimensat(unsigned int dfd, char __user *filename, struct compat_timespec __user *t, int flags) 95asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename, struct compat_timespec __user *t, int flags)
95{ 96{
96 struct timespec tv[2]; 97 struct timespec tv[2];
97 98
@@ -106,7 +107,7 @@ asmlinkage long compat_sys_utimensat(unsigned int dfd, char __user *filename, st
106 return do_utimes(dfd, filename, t ? tv : NULL, flags); 107 return do_utimes(dfd, filename, t ? tv : NULL, flags);
107} 108}
108 109
109asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, struct compat_timeval __user *t) 110asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename, struct compat_timeval __user *t)
110{ 111{
111 struct timespec tv[2]; 112 struct timespec tv[2];
112 113
@@ -125,7 +126,7 @@ asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, st
125 return do_utimes(dfd, filename, t ? tv : NULL, 0); 126 return do_utimes(dfd, filename, t ? tv : NULL, 0);
126} 127}
127 128
128asmlinkage long compat_sys_utimes(char __user *filename, struct compat_timeval __user *t) 129asmlinkage long compat_sys_utimes(const char __user *filename, struct compat_timeval __user *t)
129{ 130{
130 return compat_sys_futimesat(AT_FDCWD, filename, t); 131 return compat_sys_futimesat(AT_FDCWD, filename, t);
131} 132}
@@ -169,7 +170,7 @@ static int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf)
169 return err; 170 return err;
170} 171}
171 172
172asmlinkage long compat_sys_newstat(char __user * filename, 173asmlinkage long compat_sys_newstat(const char __user * filename,
173 struct compat_stat __user *statbuf) 174 struct compat_stat __user *statbuf)
174{ 175{
175 struct kstat stat; 176 struct kstat stat;
@@ -181,7 +182,7 @@ asmlinkage long compat_sys_newstat(char __user * filename,
181 return cp_compat_stat(&stat, statbuf); 182 return cp_compat_stat(&stat, statbuf);
182} 183}
183 184
184asmlinkage long compat_sys_newlstat(char __user * filename, 185asmlinkage long compat_sys_newlstat(const char __user * filename,
185 struct compat_stat __user *statbuf) 186 struct compat_stat __user *statbuf)
186{ 187{
187 struct kstat stat; 188 struct kstat stat;
@@ -194,7 +195,8 @@ asmlinkage long compat_sys_newlstat(char __user * filename,
194} 195}
195 196
196#ifndef __ARCH_WANT_STAT64 197#ifndef __ARCH_WANT_STAT64
197asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user *filename, 198asmlinkage long compat_sys_newfstatat(unsigned int dfd,
199 const char __user *filename,
198 struct compat_stat __user *statbuf, int flag) 200 struct compat_stat __user *statbuf, int flag)
199{ 201{
200 struct kstat stat; 202 struct kstat stat;
@@ -837,9 +839,10 @@ static int do_nfs4_super_data_conv(void *raw_data)
837#define NCPFS_NAME "ncpfs" 839#define NCPFS_NAME "ncpfs"
838#define NFS4_NAME "nfs4" 840#define NFS4_NAME "nfs4"
839 841
840asmlinkage long compat_sys_mount(char __user * dev_name, char __user * dir_name, 842asmlinkage long compat_sys_mount(const char __user * dev_name,
841 char __user * type, unsigned long flags, 843 const char __user * dir_name,
842 void __user * data) 844 const char __user * type, unsigned long flags,
845 const void __user * data)
843{ 846{
844 char *kernel_type; 847 char *kernel_type;
845 unsigned long data_page; 848 unsigned long data_page;
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 70227e0dc01d..03e59aa318eb 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1699,8 +1699,7 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
1699 goto out_fput; 1699 goto out_fput;
1700 } 1700 }
1701 1701
1702 if (!filp->f_op || 1702 if (!filp->f_op || !filp->f_op->unlocked_ioctl)
1703 (!filp->f_op->ioctl && !filp->f_op->unlocked_ioctl))
1704 goto do_ioctl; 1703 goto do_ioctl;
1705 break; 1704 break;
1706 } 1705 }
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 2d140a713861..f855ea4fc888 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -29,7 +29,6 @@
29 * @arg: command-specific argument for ioctl 29 * @arg: command-specific argument for ioctl
30 * 30 *
31 * Invokes filesystem specific ->unlocked_ioctl, if one exists; otherwise 31 * Invokes filesystem specific ->unlocked_ioctl, if one exists; otherwise
32 * invokes filesystem specific ->ioctl method. If neither method exists,
33 * returns -ENOTTY. 32 * returns -ENOTTY.
34 * 33 *
35 * Returns 0 on success, -errno on error. 34 * Returns 0 on success, -errno on error.
@@ -39,21 +38,12 @@ static long vfs_ioctl(struct file *filp, unsigned int cmd,
39{ 38{
40 int error = -ENOTTY; 39 int error = -ENOTTY;
41 40
42 if (!filp->f_op) 41 if (!filp->f_op || !filp->f_op->unlocked_ioctl)
43 goto out; 42 goto out;
44 43
45 if (filp->f_op->unlocked_ioctl) { 44 error = filp->f_op->unlocked_ioctl(filp, cmd, arg);
46 error = filp->f_op->unlocked_ioctl(filp, cmd, arg); 45 if (error == -ENOIOCTLCMD)
47 if (error == -ENOIOCTLCMD) 46 error = -EINVAL;
48 error = -EINVAL;
49 goto out;
50 } else if (filp->f_op->ioctl) {
51 lock_kernel();
52 error = filp->f_op->ioctl(filp->f_path.dentry->d_inode,
53 filp, cmd, arg);
54 unlock_kernel();
55 }
56
57 out: 47 out:
58 return error; 48 return error;
59} 49}
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c
index 675cc49197fe..9777eb5b5522 100644
--- a/fs/logfs/dir.c
+++ b/fs/logfs/dir.c
@@ -824,7 +824,7 @@ const struct inode_operations logfs_dir_iops = {
824}; 824};
825const struct file_operations logfs_dir_fops = { 825const struct file_operations logfs_dir_fops = {
826 .fsync = logfs_fsync, 826 .fsync = logfs_fsync,
827 .ioctl = logfs_ioctl, 827 .unlocked_ioctl = logfs_ioctl,
828 .readdir = logfs_readdir, 828 .readdir = logfs_readdir,
829 .read = generic_read_dir, 829 .read = generic_read_dir,
830}; 830};
diff --git a/fs/logfs/file.c b/fs/logfs/file.c
index 4dd0f7c06e39..e86376b87af1 100644
--- a/fs/logfs/file.c
+++ b/fs/logfs/file.c
@@ -181,9 +181,9 @@ static int logfs_releasepage(struct page *page, gfp_t only_xfs_uses_this)
181} 181}
182 182
183 183
184int logfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 184long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
185 unsigned long arg)
186{ 185{
186 struct inode *inode = file->f_path.dentry->d_inode;
187 struct logfs_inode *li = logfs_inode(inode); 187 struct logfs_inode *li = logfs_inode(inode);
188 unsigned int oldflags, flags; 188 unsigned int oldflags, flags;
189 int err; 189 int err;
@@ -255,7 +255,7 @@ const struct file_operations logfs_reg_fops = {
255 .aio_read = generic_file_aio_read, 255 .aio_read = generic_file_aio_read,
256 .aio_write = generic_file_aio_write, 256 .aio_write = generic_file_aio_write,
257 .fsync = logfs_fsync, 257 .fsync = logfs_fsync,
258 .ioctl = logfs_ioctl, 258 .unlocked_ioctl = logfs_ioctl,
259 .llseek = generic_file_llseek, 259 .llseek = generic_file_llseek,
260 .mmap = generic_file_readonly_mmap, 260 .mmap = generic_file_readonly_mmap,
261 .open = generic_file_open, 261 .open = generic_file_open,
diff --git a/fs/logfs/logfs.h b/fs/logfs/logfs.h
index 5e3b72077951..b8786264d243 100644
--- a/fs/logfs/logfs.h
+++ b/fs/logfs/logfs.h
@@ -504,8 +504,7 @@ extern const struct inode_operations logfs_reg_iops;
504extern const struct file_operations logfs_reg_fops; 504extern const struct file_operations logfs_reg_fops;
505extern const struct address_space_operations logfs_reg_aops; 505extern const struct address_space_operations logfs_reg_aops;
506int logfs_readpage(struct file *file, struct page *page); 506int logfs_readpage(struct file *file, struct page *page);
507int logfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 507long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
508 unsigned long arg);
509int logfs_fsync(struct file *file, int datasync); 508int logfs_fsync(struct file *file, int datasync);
510 509
511/* gc.c */ 510/* gc.c */
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 23561cda7245..9c2b5f484879 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -214,8 +214,7 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne
214{ 214{
215 struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); 215 struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
216 long rv = -ENOTTY; 216 long rv = -ENOTTY;
217 long (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); 217 long (*ioctl)(struct file *, unsigned int, unsigned long);
218 int (*ioctl)(struct inode *, struct file *, unsigned int, unsigned long);
219 218
220 spin_lock(&pde->pde_unload_lock); 219 spin_lock(&pde->pde_unload_lock);
221 if (!pde->proc_fops) { 220 if (!pde->proc_fops) {
@@ -223,19 +222,11 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne
223 return rv; 222 return rv;
224 } 223 }
225 pde->pde_users++; 224 pde->pde_users++;
226 unlocked_ioctl = pde->proc_fops->unlocked_ioctl; 225 ioctl = pde->proc_fops->unlocked_ioctl;
227 ioctl = pde->proc_fops->ioctl;
228 spin_unlock(&pde->pde_unload_lock); 226 spin_unlock(&pde->pde_unload_lock);
229 227
230 if (unlocked_ioctl) { 228 if (ioctl)
231 rv = unlocked_ioctl(file, cmd, arg); 229 rv = ioctl(file, cmd, arg);
232 if (rv == -ENOIOCTLCMD)
233 rv = -EINVAL;
234 } else if (ioctl) {
235 WARN_ONCE(1, "Procfs ioctl handlers must use unlocked_ioctl, "
236 "%pf will be called without the Bkl held\n", ioctl);
237 rv = ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
238 }
239 230
240 pde_users_dec(pde); 231 pde_users_dec(pde);
241 return rv; 232 return rv;
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;
diff --git a/fs/utimes.c b/fs/utimes.c
index e4c75db5d373..179b58690657 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -126,7 +126,8 @@ out:
126 * must be owner or have write permission. 126 * must be owner or have write permission.
127 * Else, update from *times, must be owner or super user. 127 * Else, update from *times, must be owner or super user.
128 */ 128 */
129long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags) 129long do_utimes(int dfd, const char __user *filename, struct timespec *times,
130 int flags)
130{ 131{
131 int error = -EINVAL; 132 int error = -EINVAL;
132 133
@@ -170,7 +171,7 @@ out:
170 return error; 171 return error;
171} 172}
172 173
173SYSCALL_DEFINE4(utimensat, int, dfd, char __user *, filename, 174SYSCALL_DEFINE4(utimensat, int, dfd, const char __user *, filename,
174 struct timespec __user *, utimes, int, flags) 175 struct timespec __user *, utimes, int, flags)
175{ 176{
176 struct timespec tstimes[2]; 177 struct timespec tstimes[2];
@@ -188,7 +189,7 @@ SYSCALL_DEFINE4(utimensat, int, dfd, char __user *, filename,
188 return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags); 189 return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags);
189} 190}
190 191
191SYSCALL_DEFINE3(futimesat, int, dfd, char __user *, filename, 192SYSCALL_DEFINE3(futimesat, int, dfd, const char __user *, filename,
192 struct timeval __user *, utimes) 193 struct timeval __user *, utimes)
193{ 194{
194 struct timeval times[2]; 195 struct timeval times[2];
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 168f7daa7bde..9ddc8780e8db 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -331,7 +331,7 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,
331 const compat_sigset_t __user *sigmask, 331 const compat_sigset_t __user *sigmask,
332 compat_size_t sigsetsize); 332 compat_size_t sigsetsize);
333 333
334asmlinkage long compat_sys_utimensat(unsigned int dfd, char __user *filename, 334asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename,
335 struct compat_timespec __user *t, int flags); 335 struct compat_timespec __user *t, int flags);
336 336
337asmlinkage long compat_sys_signalfd(int ufd, 337asmlinkage long compat_sys_signalfd(int ufd,
@@ -348,9 +348,9 @@ asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
348 const int __user *nodes, 348 const int __user *nodes,
349 int __user *status, 349 int __user *status,
350 int flags); 350 int flags);
351asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, 351asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename,
352 struct compat_timeval __user *t); 352 struct compat_timeval __user *t);
353asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename, 353asmlinkage long compat_sys_newfstatat(unsigned int dfd, const char __user * filename,
354 struct compat_stat __user *statbuf, 354 struct compat_stat __user *statbuf,
355 int flag); 355 int flag);
356asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 356asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index e0670a512056..ce29b8151198 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -142,6 +142,7 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)
142 return -EIO; 142 return -EIO;
143} 143}
144 144
145#ifdef CONFIG_HAS_DMA
145static inline int dma_get_cache_alignment(void) 146static inline int dma_get_cache_alignment(void)
146{ 147{
147#ifdef ARCH_DMA_MINALIGN 148#ifdef ARCH_DMA_MINALIGN
@@ -149,6 +150,7 @@ static inline int dma_get_cache_alignment(void)
149#endif 150#endif
150 return 1; 151 return 1;
151} 152}
153#endif
152 154
153/* flags for the coherent memory api */ 155/* flags for the coherent memory api */
154#define DMA_MEMORY_MAP 0x01 156#define DMA_MEMORY_MAP 0x01
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7a0625e26a39..9a96b4d83fc1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1483,8 +1483,8 @@ struct block_device_operations;
1483 1483
1484/* 1484/*
1485 * NOTE: 1485 * NOTE:
1486 * read, write, poll, fsync, readv, writev, unlocked_ioctl and compat_ioctl 1486 * all file operations except setlease can be called without
1487 * can be called without the big kernel lock held in all filesystems. 1487 * the big kernel lock held in all filesystems.
1488 */ 1488 */
1489struct file_operations { 1489struct file_operations {
1490 struct module *owner; 1490 struct module *owner;
@@ -1495,7 +1495,6 @@ struct file_operations {
1495 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1495 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1496 int (*readdir) (struct file *, void *, filldir_t); 1496 int (*readdir) (struct file *, void *, filldir_t);
1497 unsigned int (*poll) (struct file *, struct poll_table_struct *); 1497 unsigned int (*poll) (struct file *, struct poll_table_struct *);
1498 int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
1499 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 1498 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
1500 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 1499 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
1501 int (*mmap) (struct file *, struct vm_area_struct *); 1500 int (*mmap) (struct file *, struct vm_area_struct *);
@@ -2320,10 +2319,10 @@ void inode_set_bytes(struct inode *inode, loff_t bytes);
2320 2319
2321extern int vfs_readdir(struct file *, filldir_t, void *); 2320extern int vfs_readdir(struct file *, filldir_t, void *);
2322 2321
2323extern int vfs_stat(char __user *, struct kstat *); 2322extern int vfs_stat(const char __user *, struct kstat *);
2324extern int vfs_lstat(char __user *, struct kstat *); 2323extern int vfs_lstat(const char __user *, struct kstat *);
2325extern int vfs_fstat(unsigned int, struct kstat *); 2324extern int vfs_fstat(unsigned int, struct kstat *);
2326extern int vfs_fstatat(int , char __user *, struct kstat *, int); 2325extern int vfs_fstatat(int , const char __user *, struct kstat *, int);
2327 2326
2328extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2327extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2329 unsigned long arg); 2328 unsigned long arg);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 1b67bd333b5e..6e5d19788634 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -394,7 +394,7 @@ asmlinkage long sys_umount(char __user *name, int flags);
394asmlinkage long sys_oldumount(char __user *name); 394asmlinkage long sys_oldumount(char __user *name);
395asmlinkage long sys_truncate(const char __user *path, long length); 395asmlinkage long sys_truncate(const char __user *path, long length);
396asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); 396asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
397asmlinkage long sys_stat(char __user *filename, 397asmlinkage long sys_stat(const char __user *filename,
398 struct __old_kernel_stat __user *statbuf); 398 struct __old_kernel_stat __user *statbuf);
399asmlinkage long sys_statfs(const char __user * path, 399asmlinkage long sys_statfs(const char __user * path,
400 struct statfs __user *buf); 400 struct statfs __user *buf);
@@ -403,21 +403,21 @@ asmlinkage long sys_statfs64(const char __user *path, size_t sz,
403asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user *buf); 403asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user *buf);
404asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, 404asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz,
405 struct statfs64 __user *buf); 405 struct statfs64 __user *buf);
406asmlinkage long sys_lstat(char __user *filename, 406asmlinkage long sys_lstat(const char __user *filename,
407 struct __old_kernel_stat __user *statbuf); 407 struct __old_kernel_stat __user *statbuf);
408asmlinkage long sys_fstat(unsigned int fd, 408asmlinkage long sys_fstat(unsigned int fd,
409 struct __old_kernel_stat __user *statbuf); 409 struct __old_kernel_stat __user *statbuf);
410asmlinkage long sys_newstat(char __user *filename, 410asmlinkage long sys_newstat(const char __user *filename,
411 struct stat __user *statbuf); 411 struct stat __user *statbuf);
412asmlinkage long sys_newlstat(char __user *filename, 412asmlinkage long sys_newlstat(const char __user *filename,
413 struct stat __user *statbuf); 413 struct stat __user *statbuf);
414asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf); 414asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf);
415asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf); 415asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf);
416#if BITS_PER_LONG == 32 416#if BITS_PER_LONG == 32
417asmlinkage long sys_stat64(char __user *filename, 417asmlinkage long sys_stat64(const char __user *filename,
418 struct stat64 __user *statbuf); 418 struct stat64 __user *statbuf);
419asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf); 419asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf);
420asmlinkage long sys_lstat64(char __user *filename, 420asmlinkage long sys_lstat64(const char __user *filename,
421 struct stat64 __user *statbuf); 421 struct stat64 __user *statbuf);
422asmlinkage long sys_truncate64(const char __user *path, loff_t length); 422asmlinkage long sys_truncate64(const char __user *path, loff_t length);
423asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length); 423asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
@@ -760,7 +760,7 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
760 int newdfd, const char __user *newname, int flags); 760 int newdfd, const char __user *newname, int flags);
761asmlinkage long sys_renameat(int olddfd, const char __user * oldname, 761asmlinkage long sys_renameat(int olddfd, const char __user * oldname,
762 int newdfd, const char __user * newname); 762 int newdfd, const char __user * newname);
763asmlinkage long sys_futimesat(int dfd, char __user *filename, 763asmlinkage long sys_futimesat(int dfd, const char __user *filename,
764 struct timeval __user *utimes); 764 struct timeval __user *utimes);
765asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode); 765asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
766asmlinkage long sys_fchmodat(int dfd, const char __user * filename, 766asmlinkage long sys_fchmodat(int dfd, const char __user * filename,
@@ -769,13 +769,13 @@ asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
769 gid_t group, int flag); 769 gid_t group, int flag);
770asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 770asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
771 int mode); 771 int mode);
772asmlinkage long sys_newfstatat(int dfd, char __user *filename, 772asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
773 struct stat __user *statbuf, int flag); 773 struct stat __user *statbuf, int flag);
774asmlinkage long sys_fstatat64(int dfd, char __user *filename, 774asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
775 struct stat64 __user *statbuf, int flag); 775 struct stat64 __user *statbuf, int flag);
776asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf, 776asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf,
777 int bufsiz); 777 int bufsiz);
778asmlinkage long sys_utimensat(int dfd, char __user *filename, 778asmlinkage long sys_utimensat(int dfd, const char __user *filename,
779 struct timespec __user *utimes, int flags); 779 struct timespec __user *utimes, int flags);
780asmlinkage long sys_unshare(unsigned long unshare_flags); 780asmlinkage long sys_unshare(unsigned long unshare_flags);
781 781
diff --git a/include/linux/time.h b/include/linux/time.h
index 12612701b1ae..9f15ac7ab92a 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -150,7 +150,7 @@ extern void do_gettimeofday(struct timeval *tv);
150extern int do_settimeofday(struct timespec *tv); 150extern int do_settimeofday(struct timespec *tv);
151extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); 151extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz);
152#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) 152#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
153extern long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags); 153extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags);
154struct itimerval; 154struct itimerval;
155extern int do_setitimer(int which, struct itimerval *value, 155extern int do_setitimer(int which, struct itimerval *value,
156 struct itimerval *ovalue); 156 struct itimerval *ovalue);
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index e960d824263f..49010d822f72 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -710,9 +710,10 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
710 /* Accumulate raw time */ 710 /* Accumulate raw time */
711 raw_nsecs = timekeeper.raw_interval << shift; 711 raw_nsecs = timekeeper.raw_interval << shift;
712 raw_nsecs += raw_time.tv_nsec; 712 raw_nsecs += raw_time.tv_nsec;
713 while (raw_nsecs >= NSEC_PER_SEC) { 713 if (raw_nsecs >= NSEC_PER_SEC) {
714 raw_nsecs -= NSEC_PER_SEC; 714 u64 raw_secs = raw_nsecs;
715 raw_time.tv_sec++; 715 raw_nsecs = do_div(raw_secs, NSEC_PER_SEC);
716 raw_time.tv_sec += raw_secs;
716 } 717 }
717 raw_time.tv_nsec = raw_nsecs; 718 raw_time.tv_nsec = raw_nsecs;
718 719
diff --git a/mm/nommu.c b/mm/nommu.c
index b76f3ee0abe0..efa9a380335e 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -36,11 +36,6 @@
36#include <asm/mmu_context.h> 36#include <asm/mmu_context.h>
37#include "internal.h" 37#include "internal.h"
38 38
39static inline __attribute__((format(printf, 1, 2)))
40void no_printk(const char *fmt, ...)
41{
42}
43
44#if 0 39#if 0
45#define kenter(FMT, ...) \ 40#define kenter(FMT, ...) \
46 printk(KERN_DEBUG "==> %s("FMT")\n", __func__, ##__VA_ARGS__) 41 printk(KERN_DEBUG "==> %s("FMT")\n", __func__, ##__VA_ARGS__)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 274f2716b03e..5b7c86ea43a1 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -108,7 +108,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
108 check_stdin(); 108 check_stdin();
109 case oldaskconfig: 109 case oldaskconfig:
110 fflush(stdout); 110 fflush(stdout);
111 fgets(line, 128, stdin); 111 xfgets(line, 128, stdin);
112 return 1; 112 return 1;
113 default: 113 default:
114 break; 114 break;
@@ -306,7 +306,7 @@ static int conf_choice(struct menu *menu)
306 check_stdin(); 306 check_stdin();
307 case oldaskconfig: 307 case oldaskconfig:
308 fflush(stdout); 308 fflush(stdout);
309 fgets(line, 128, stdin); 309 xfgets(line, 128, stdin);
310 strip(line); 310 strip(line);
311 if (line[0] == '?') { 311 if (line[0] == '?') {
312 print_help(menu); 312 print_help(menu);
@@ -644,3 +644,14 @@ int main(int ac, char **av)
644 } 644 }
645 return 0; 645 return 0;
646} 646}
647/*
648 * Helper function to facilitate fgets() by Jean Sacren.
649 */
650void xfgets(str, size, in)
651 char *str;
652 int size;
653 FILE *in;
654{
655 if (fgets(str, size, in) == NULL)
656 fprintf(stderr, "\nError in reading or end of file.\n");
657}
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index f81f263b64f2..c39327e60ea4 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -412,7 +412,7 @@ static void conf_write_string(bool headerfile, const char *name,
412 while (1) { 412 while (1) {
413 l = strcspn(str, "\"\\"); 413 l = strcspn(str, "\"\\");
414 if (l) { 414 if (l) {
415 fwrite(str, l, 1, out); 415 xfwrite(str, l, 1, out);
416 str += l; 416 str += l;
417 } 417 }
418 if (!*str) 418 if (!*str)
@@ -497,7 +497,7 @@ int conf_write_defconfig(const char *filename)
497 /* 497 /*
498 * If symbol is a choice value and equals to the 498 * If symbol is a choice value and equals to the
499 * default for a choice - skip. 499 * default for a choice - skip.
500 * But only if value equal to "y". 500 * But only if value is bool and equal to "y" .
501 */ 501 */
502 if (sym_is_choice_value(sym)) { 502 if (sym_is_choice_value(sym)) {
503 struct symbol *cs; 503 struct symbol *cs;
@@ -506,9 +506,8 @@ int conf_write_defconfig(const char *filename)
506 cs = prop_get_symbol(sym_get_choice_prop(sym)); 506 cs = prop_get_symbol(sym_get_choice_prop(sym));
507 ds = sym_choice_default(cs); 507 ds = sym_choice_default(cs);
508 if (sym == ds) { 508 if (sym == ds) {
509 if ((sym->type == S_BOOLEAN || 509 if ((sym->type == S_BOOLEAN) &&
510 sym->type == S_TRISTATE) && 510 sym_get_tristate_value(sym) == yes)
511 sym_get_tristate_value(sym) == yes)
512 goto next_menu; 511 goto next_menu;
513 } 512 }
514 } 513 }
@@ -919,13 +918,73 @@ void conf_set_changed_callback(void (*fn)(void))
919 conf_changed_callback = fn; 918 conf_changed_callback = fn;
920} 919}
921 920
921static void randomize_choice_values(struct symbol *csym)
922{
923 struct property *prop;
924 struct symbol *sym;
925 struct expr *e;
926 int cnt, def;
922 927
923void conf_set_all_new_symbols(enum conf_def_mode mode) 928 /*
929 * If choice is mod then we may have more items slected
930 * and if no then no-one.
931 * In both cases stop.
932 */
933 if (csym->curr.tri != yes)
934 return;
935
936 prop = sym_get_choice_prop(csym);
937
938 /* count entries in choice block */
939 cnt = 0;
940 expr_list_for_each_sym(prop->expr, e, sym)
941 cnt++;
942
943 /*
944 * find a random value and set it to yes,
945 * set the rest to no so we have only one set
946 */
947 def = (rand() % cnt);
948
949 cnt = 0;
950 expr_list_for_each_sym(prop->expr, e, sym) {
951 if (def == cnt++) {
952 sym->def[S_DEF_USER].tri = yes;
953 csym->def[S_DEF_USER].val = sym;
954 }
955 else {
956 sym->def[S_DEF_USER].tri = no;
957 }
958 }
959 csym->flags |= SYMBOL_DEF_USER;
960 /* clear VALID to get value calculated */
961 csym->flags &= ~(SYMBOL_VALID);
962}
963
964static void set_all_choice_values(struct symbol *csym)
924{ 965{
925 struct symbol *sym, *csym;
926 struct property *prop; 966 struct property *prop;
967 struct symbol *sym;
927 struct expr *e; 968 struct expr *e;
928 int i, cnt, def; 969
970 prop = sym_get_choice_prop(csym);
971
972 /*
973 * Set all non-assinged choice values to no
974 */
975 expr_list_for_each_sym(prop->expr, e, sym) {
976 if (!sym_has_value(sym))
977 sym->def[S_DEF_USER].tri = no;
978 }
979 csym->flags |= SYMBOL_DEF_USER;
980 /* clear VALID to get value calculated */
981 csym->flags &= ~(SYMBOL_VALID);
982}
983
984void conf_set_all_new_symbols(enum conf_def_mode mode)
985{
986 struct symbol *sym, *csym;
987 int i, cnt;
929 988
930 for_all_symbols(i, sym) { 989 for_all_symbols(i, sym) {
931 if (sym_has_value(sym)) 990 if (sym_has_value(sym))
@@ -961,8 +1020,6 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
961 1020
962 sym_clear_all_valid(); 1021 sym_clear_all_valid();
963 1022
964 if (mode != def_random)
965 return;
966 /* 1023 /*
967 * We have different type of choice blocks. 1024 * We have different type of choice blocks.
968 * If curr.tri equal to mod then we can select several 1025 * If curr.tri equal to mod then we can select several
@@ -977,35 +1034,9 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
977 continue; 1034 continue;
978 1035
979 sym_calc_value(csym); 1036 sym_calc_value(csym);
980 1037 if (mode == def_random)
981 if (csym->curr.tri != yes) 1038 randomize_choice_values(csym);
982 continue; 1039 else
983 1040 set_all_choice_values(csym);
984 prop = sym_get_choice_prop(csym);
985
986 /* count entries in choice block */
987 cnt = 0;
988 expr_list_for_each_sym(prop->expr, e, sym)
989 cnt++;
990
991 /*
992 * find a random value and set it to yes,
993 * set the rest to no so we have only one set
994 */
995 def = (rand() % cnt);
996
997 cnt = 0;
998 expr_list_for_each_sym(prop->expr, e, sym) {
999 if (def == cnt++) {
1000 sym->def[S_DEF_USER].tri = yes;
1001 csym->def[S_DEF_USER].val = sym;
1002 }
1003 else {
1004 sym->def[S_DEF_USER].tri = no;
1005 }
1006 }
1007 csym->flags |= SYMBOL_DEF_USER;
1008 /* clear VALID to get value calculated */
1009 csym->flags &= ~(SYMBOL_VALID);
1010 } 1041 }
1011} 1042}
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 8f18e37892cb..330e7c0048a8 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1087,7 +1087,7 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
1087 1087
1088static void expr_print_file_helper(void *data, struct symbol *sym, const char *str) 1088static void expr_print_file_helper(void *data, struct symbol *sym, const char *str)
1089{ 1089{
1090 fwrite(str, strlen(str), 1, data); 1090 xfwrite(str, strlen(str), 1, data);
1091} 1091}
1092 1092
1093void expr_fprint(struct expr *e, FILE *out) 1093void expr_fprint(struct expr *e, FILE *out)
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 76db065ed72c..bdf71bd31412 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -72,6 +72,9 @@ void zconf_nextfile(const char *name);
72int zconf_lineno(void); 72int zconf_lineno(void);
73char *zconf_curname(void); 73char *zconf_curname(void);
74 74
75/* conf.c */
76void xfgets(char *str, int size, FILE *in);
77
75/* confdata.c */ 78/* confdata.c */
76const char *conf_get_configname(void); 79const char *conf_get_configname(void);
77const char *conf_get_autoconfig_name(void); 80const char *conf_get_autoconfig_name(void);
@@ -80,6 +83,13 @@ void sym_set_change_count(int count);
80void sym_add_change_count(int count); 83void sym_add_change_count(int count);
81void conf_set_all_new_symbols(enum conf_def_mode mode); 84void conf_set_all_new_symbols(enum conf_def_mode mode);
82 85
86/* confdata.c and expr.c */
87static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
88{
89 if (fwrite(str, len, count, out) < count)
90 fprintf(stderr, "\nError in writing or end of file.\n");
91}
92
83/* kconfig_load.c */ 93/* kconfig_load.c */
84void kconfig_load(void); 94void kconfig_load(void);
85 95
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 762caf80ce37..2ba71bcd38e6 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -676,6 +676,8 @@ static void *item_data(void)
676 struct mitem *mcur; 676 struct mitem *mcur;
677 677
678 cur = current_item(curses_menu); 678 cur = current_item(curses_menu);
679 if (!cur)
680 return NULL;
679 mcur = (struct mitem *) item_userptr(cur); 681 mcur = (struct mitem *) item_userptr(cur);
680 return mcur->usrptr; 682 return mcur->usrptr;
681 683
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 64a9cb5556cd..e90a91cc5185 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -86,7 +86,7 @@ scm_version()
86 86
87 # Check for mercurial and a mercurial repo. 87 # Check for mercurial and a mercurial repo.
88 if hgid=`hg id 2>/dev/null`; then 88 if hgid=`hg id 2>/dev/null`; then
89 tag=`printf '%s' "$hgid" | cut -d' ' -f2` 89 tag=`printf '%s' "$hgid" | cut -s -d' ' -f2`
90 90
91 # Do we have an untagged version? 91 # Do we have an untagged version?
92 if [ -z "$tag" -o "$tag" = tip ]; then 92 if [ -z "$tag" -o "$tag" = tip ]; then