aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_flat.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/binfmt_flat.c')
-rw-r--r--fs/binfmt_flat.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index fcb3405bb14e..33764fd6db66 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -75,7 +75,7 @@ static int load_flat_shared_library(int id, struct lib_info *p);
75#endif 75#endif
76 76
77static int load_flat_binary(struct linux_binprm *, struct pt_regs * regs); 77static int load_flat_binary(struct linux_binprm *, struct pt_regs * regs);
78static int flat_core_dump(long signr, struct pt_regs * regs, struct file *file); 78static int flat_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
79 79
80static struct linux_binfmt flat_format = { 80static struct linux_binfmt flat_format = {
81 .module = THIS_MODULE, 81 .module = THIS_MODULE,
@@ -90,7 +90,7 @@ static struct linux_binfmt flat_format = {
90 * Currently only a stub-function. 90 * Currently only a stub-function.
91 */ 91 */
92 92
93static int flat_core_dump(long signr, struct pt_regs * regs, struct file *file) 93static int flat_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
94{ 94{
95 printk("Process %s:%d received signr %d and should have core dumped\n", 95 printk("Process %s:%d received signr %d and should have core dumped\n",
96 current->comm, current->pid, (int) signr); 96 current->comm, current->pid, (int) signr);
@@ -113,7 +113,7 @@ static unsigned long create_flat_tables(
113 char * p = (char*)pp; 113 char * p = (char*)pp;
114 int argc = bprm->argc; 114 int argc = bprm->argc;
115 int envc = bprm->envc; 115 int envc = bprm->envc;
116 char dummy; 116 char uninitialized_var(dummy);
117 117
118 sp = (unsigned long *) ((-(unsigned long)sizeof(char *))&(unsigned long) p); 118 sp = (unsigned long *) ((-(unsigned long)sizeof(char *))&(unsigned long) p);
119 119
@@ -290,7 +290,6 @@ out_free_buf:
290 kfree(buf); 290 kfree(buf);
291out_free: 291out_free:
292 kfree(strm.workspace); 292 kfree(strm.workspace);
293out:
294 return retval; 293 return retval;
295} 294}
296 295
@@ -459,7 +458,9 @@ static int load_flat_file(struct linux_binprm * bprm,
459 printk("BINFMT_FLAT: Loading file: %s\n", bprm->filename); 458 printk("BINFMT_FLAT: Loading file: %s\n", bprm->filename);
460 459
461 if (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION) { 460 if (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION) {
462 printk("BINFMT_FLAT: bad flat file version 0x%x (supported 0x%x and 0x%x)\n", rev, FLAT_VERSION, OLD_FLAT_VERSION); 461 printk("BINFMT_FLAT: bad flat file version 0x%x (supported "
462 "0x%lx and 0x%lx)\n",
463 rev, FLAT_VERSION, OLD_FLAT_VERSION);
463 ret = -ENOEXEC; 464 ret = -ENOEXEC;
464 goto err; 465 goto err;
465 } 466 }
@@ -515,7 +516,8 @@ static int load_flat_file(struct linux_binprm * bprm,
515 /* 516 /*
516 * calculate the extra space we need to map in 517 * calculate the extra space we need to map in
517 */ 518 */
518 extra = max(bss_len + stack_len, relocs * sizeof(unsigned long)); 519 extra = max_t(unsigned long, bss_len + stack_len,
520 relocs * sizeof(unsigned long));
519 521
520 /* 522 /*
521 * there are a couple of cases here, the separate code/data 523 * there are a couple of cases here, the separate code/data
@@ -546,7 +548,7 @@ static int load_flat_file(struct linux_binprm * bprm,
546 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); 548 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0);
547 /* Remap to use all availabe slack region space */ 549 /* Remap to use all availabe slack region space */
548 if (realdatastart && (realdatastart < (unsigned long)-4096)) { 550 if (realdatastart && (realdatastart < (unsigned long)-4096)) {
549 reallen = ksize(realdatastart); 551 reallen = ksize((void *)realdatastart);
550 if (reallen > len) { 552 if (reallen > len) {
551 realdatastart = do_mremap(realdatastart, len, 553 realdatastart = do_mremap(realdatastart, len,
552 reallen, MREMAP_FIXED, realdatastart); 554 reallen, MREMAP_FIXED, realdatastart);
@@ -598,7 +600,7 @@ static int load_flat_file(struct linux_binprm * bprm,
598 PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); 600 PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0);
599 /* Remap to use all availabe slack region space */ 601 /* Remap to use all availabe slack region space */
600 if (textpos && (textpos < (unsigned long) -4096)) { 602 if (textpos && (textpos < (unsigned long) -4096)) {
601 reallen = ksize(textpos); 603 reallen = ksize((void *)textpos);
602 if (reallen > len) { 604 if (reallen > len) {
603 textpos = do_mremap(textpos, len, reallen, 605 textpos = do_mremap(textpos, len, reallen,
604 MREMAP_FIXED, textpos); 606 MREMAP_FIXED, textpos);