Make do_execve() take a const filename pointer
authorDavid Howells <dhowells@redhat.com>
Tue, 17 Aug 2010 22:52:56 +0000 (23:52 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 18 Aug 2010 01:07:43 +0000 (18:07 -0700)
commitd7627467b7a8dd6944885290a03a07ceb28c10eb
treea18c83468418e878cfb2d44e4310d81b8db84ad7
parentda5cabf80e2433131bf0ed8993abc0f7ea618c73
Make do_execve() take a const filename pointer

Make do_execve() take a const filename pointer so that kernel_execve() compiles
correctly on ARM:

arch/arm/kernel/sys_arm.c:88: warning: passing argument 1 of 'do_execve' discards qualifiers from pointer target type

This also requires the argv and envp arguments to be consted twice, once for
the pointer array and once for the strings the array points to.  This is
because do_execve() passes a pointer to the filename (now const) to
copy_strings_kernel().  A simpler alternative would be to cast the filename
pointer in do_execve() when it's passed to copy_strings_kernel().

do_execve() may not change any of the strings it is passed as part of the argv
or envp lists as they are some of them in .rodata, so marking these strings as
const should be fine.

Further kernel_execve() and sys_execve() need to be changed to match.

This has been test built on x86_64, frv, arm and mips.

Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
50 files changed:
arch/alpha/kernel/process.c
arch/arm/kernel/sys_arm.c
arch/avr32/kernel/process.c
arch/avr32/kernel/sys_avr32.c
arch/blackfin/kernel/process.c
arch/cris/arch-v10/kernel/process.c
arch/cris/arch-v32/kernel/process.c
arch/frv/kernel/process.c
arch/h8300/kernel/process.c
arch/h8300/kernel/sys_h8300.c
arch/ia64/kernel/process.c
arch/m32r/kernel/process.c
arch/m32r/kernel/sys_m32r.c
arch/m68k/kernel/process.c
arch/m68k/kernel/sys_m68k.c
arch/m68knommu/kernel/process.c
arch/m68knommu/kernel/sys_m68k.c
arch/microblaze/kernel/sys_microblaze.c
arch/mips/kernel/syscall.c
arch/mn10300/kernel/process.c
arch/parisc/hpux/fs.c
arch/parisc/kernel/process.c
arch/powerpc/kernel/process.c
arch/s390/kernel/process.c
arch/score/kernel/sys_score.c
arch/sh/kernel/process_32.c
arch/sh/kernel/process_64.c
arch/sh/kernel/sys_sh32.c
arch/sh/kernel/sys_sh64.c
arch/sparc/kernel/process_32.c
arch/sparc/kernel/process_64.c
arch/sparc/kernel/sys_sparc_32.c
arch/sparc/kernel/sys_sparc_64.c
arch/tile/kernel/process.c
arch/um/kernel/exec.c
arch/um/kernel/syscall.c
arch/x86/include/asm/syscalls.h
arch/x86/kernel/process.c
arch/x86/kernel/sys_i386_32.c
arch/xtensa/kernel/process.c
fs/binfmt_misc.c
fs/binfmt_script.c
fs/exec.c
include/linux/binfmts.h
include/linux/sched.h
include/linux/syscalls.h
init/do_mounts_initrd.c
init/main.c
kernel/kmod.c
security/commoncap.c