diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2008-06-06 01:46:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-06-06 14:29:13 -0400 |
commit | d100d148aa48df3b6ad526a48624f906695efe60 (patch) | |
tree | 8ad38c91cca149b8a6b186c4808e30264e8fb106 /fs | |
parent | 0842b245a8e6c14e3aa49f91018902591d1069b3 (diff) |
nommu: fix ksize() abuse
The nommu binfmt code uses ksize() for pointers returned from do_mmap()
which is wrong. This converts the call-sites to use the nommu specific
kobjsize() function which works as expected.
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Matt Mackall <mpm@selenic.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Acked-by: Greg Ungerer <gerg@snapgear.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/binfmt_elf_fdpic.c | 2 | ||||
-rw-r--r-- | fs/binfmt_flat.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index ddd35d873391..d051a32e6270 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -390,7 +390,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm, | |||
390 | } | 390 | } |
391 | 391 | ||
392 | /* expand the stack mapping to use up the entire allocation granule */ | 392 | /* expand the stack mapping to use up the entire allocation granule */ |
393 | fullsize = ksize((char *) current->mm->start_brk); | 393 | fullsize = kobjsize((char *) current->mm->start_brk); |
394 | if (!IS_ERR_VALUE(do_mremap(current->mm->start_brk, stack_size, | 394 | if (!IS_ERR_VALUE(do_mremap(current->mm->start_brk, stack_size, |
395 | fullsize, 0, 0))) | 395 | fullsize, 0, 0))) |
396 | stack_size = fullsize; | 396 | stack_size = fullsize; |
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 3b40d45a3a16..2cb1acda3a82 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -548,7 +548,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
548 | PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); | 548 | PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); |
549 | /* Remap to use all availabe slack region space */ | 549 | /* Remap to use all availabe slack region space */ |
550 | if (realdatastart && (realdatastart < (unsigned long)-4096)) { | 550 | if (realdatastart && (realdatastart < (unsigned long)-4096)) { |
551 | reallen = ksize((void *)realdatastart); | 551 | reallen = kobjsize((void *)realdatastart); |
552 | if (reallen > len) { | 552 | if (reallen > len) { |
553 | realdatastart = do_mremap(realdatastart, len, | 553 | realdatastart = do_mremap(realdatastart, len, |
554 | reallen, MREMAP_FIXED, realdatastart); | 554 | reallen, MREMAP_FIXED, realdatastart); |
@@ -600,7 +600,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
600 | PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); | 600 | PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); |
601 | /* Remap to use all availabe slack region space */ | 601 | /* Remap to use all availabe slack region space */ |
602 | if (textpos && (textpos < (unsigned long) -4096)) { | 602 | if (textpos && (textpos < (unsigned long) -4096)) { |
603 | reallen = ksize((void *)textpos); | 603 | reallen = kobjsize((void *)textpos); |
604 | if (reallen > len) { | 604 | if (reallen > len) { |
605 | textpos = do_mremap(textpos, len, reallen, | 605 | textpos = do_mremap(textpos, len, reallen, |
606 | MREMAP_FIXED, textpos); | 606 | MREMAP_FIXED, textpos); |
@@ -683,7 +683,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
683 | */ | 683 | */ |
684 | current->mm->start_brk = datapos + data_len + bss_len; | 684 | current->mm->start_brk = datapos + data_len + bss_len; |
685 | current->mm->brk = (current->mm->start_brk + 3) & ~3; | 685 | current->mm->brk = (current->mm->start_brk + 3) & ~3; |
686 | current->mm->context.end_brk = memp + ksize((void *) memp) - stack_len; | 686 | current->mm->context.end_brk = memp + kobjsize((void *) memp) - stack_len; |
687 | } | 687 | } |
688 | 688 | ||
689 | if (flags & FLAT_FLAG_KTRACE) | 689 | if (flags & FLAT_FLAG_KTRACE) |
@@ -790,7 +790,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
790 | 790 | ||
791 | /* zero the BSS, BRK and stack areas */ | 791 | /* zero the BSS, BRK and stack areas */ |
792 | memset((void*)(datapos + data_len), 0, bss_len + | 792 | memset((void*)(datapos + data_len), 0, bss_len + |
793 | (memp + ksize((void *) memp) - stack_len - /* end brk */ | 793 | (memp + kobjsize((void *) memp) - stack_len - /* end brk */ |
794 | libinfo->lib_list[id].start_brk) + /* start brk */ | 794 | libinfo->lib_list[id].start_brk) + /* start brk */ |
795 | stack_len); | 795 | stack_len); |
796 | 796 | ||