Commit 7857e0a1 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] put_user() warning fix

Patch from Russell King <rmk@arm.linux.org.uk>

Have a couple of extra warnings:

fs/binfmt_elf.c: In function `create_elf_tables':
fs/binfmt_elf.c:239: warning: initialization makes integer from pointer without a cast
fs/binfmt_elf.c:249: warning: initialization makes integer from pointer without a cast

#ifndef elf_addr_t
#define elf_addr_t unsigned long
#endif

        elf_addr_t *argv, *envp;

        __put_user(NULL, argv);
        __put_user(NULL, envp);

It would therefore appear that x86 __put_user is not properly type-checking
the arguments to __put_user().

Here's a patch which fixes the warning (but doesn't fix x86's type-check
challenged __put_user implementation).
parent 8c4ea5db
...@@ -236,7 +236,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec, ...@@ -236,7 +236,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec,
return; return;
p += len; p += len;
} }
__put_user(NULL, argv); __put_user(0, argv);
current->mm->arg_end = current->mm->env_start = p; current->mm->arg_end = current->mm->env_start = p;
while (envc-- > 0) { while (envc-- > 0) {
size_t len; size_t len;
...@@ -246,7 +246,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec, ...@@ -246,7 +246,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec,
return; return;
p += len; p += len;
} }
__put_user(NULL, envp); __put_user(0, envp);
current->mm->env_end = p; current->mm->env_end = p;
/* Put the elf_info on the stack in the right place. */ /* Put the elf_info on the stack in the right place. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment