Merge master.kernel.org:/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw
[pandora-kernel.git] / arch / mips / kernel / irixelf.c
index 5aeacc1..1bbefbf 100644 (file)
@@ -52,10 +52,6 @@ static struct linux_binfmt irix_format = {
        irix_core_dump, PAGE_SIZE
 };
 
-#ifndef elf_addr_t
-#define elf_addr_t unsigned long
-#endif
-
 #ifdef DEBUG
 /* Debugging routines. */
 static char *get_elf_p_type(Elf32_Word p_type)
@@ -422,9 +418,7 @@ static inline int look_for_irix_interpreter(char **name,
                if (*name != NULL)
                        goto out;
 
-               *name = (char *) kmalloc((epp->p_filesz +
-                                         strlen(IRIX_EMUL)),
-                                        GFP_KERNEL);
+               *name = kmalloc(epp->p_filesz + strlen(IRIX_EMUL), GFP_KERNEL);
                if (!*name)
                        return -ENOMEM;
 
@@ -699,7 +693,6 @@ static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
        /* Do this so that we can load the interpreter, if need be.  We will
         * change some of these later.
         */
-       set_mm_counter(current->mm, rss, 0);
        setup_arg_pages(bprm, STACK_TOP, EXSTACK_DEFAULT);
        current->mm->start_stack = bprm->p;
 
@@ -1002,8 +995,6 @@ static inline int maydump(struct vm_area_struct *vma)
        return 1;
 }
 
-#define roundup(x, y)  ((((x)+((y)-1))/(y))*(y))
-
 /* An ELF note in memory. */
 struct memelfnote
 {
@@ -1018,7 +1009,7 @@ static int notesize(struct memelfnote *en)
        int sz;
 
        sz = sizeof(struct elf_note);
-       sz += roundup(strlen(en->name), 4);
+       sz += roundup(strlen(en->name) + 1, 4);
        sz += roundup(en->datasz, 4);
 
        return sz;
@@ -1037,7 +1028,7 @@ static int writenote(struct memelfnote *men, struct file *file)
 {
        struct elf_note en;
 
-       en.n_namesz = strlen(men->name);
+       en.n_namesz = strlen(men->name) + 1;
        en.n_descsz = men->datasz;
        en.n_type = men->type;
 
@@ -1080,8 +1071,8 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
        struct elfhdr elf;
        off_t offset = 0, dataoff;
        int limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
-       int numnote = 4;
-       struct memelfnote notes[4];
+       int numnote = 3;
+       struct memelfnote notes[3];
        struct elf_prstatus prstatus;   /* NT_PRSTATUS */
        elf_fpregset_t fpu;             /* NT_PRFPREG */
        struct elf_prpsinfo psinfo;     /* NT_PRPSINFO */
@@ -1214,20 +1205,15 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
        }
        strlcpy(psinfo.pr_fname, current->comm, sizeof(psinfo.pr_fname));
 
-       notes[2].name = "CORE";
-       notes[2].type = NT_TASKSTRUCT;
-       notes[2].datasz = sizeof(*current);
-       notes[2].data = current;
-
        /* Try to dump the FPU. */
        prstatus.pr_fpvalid = dump_fpu (regs, &fpu);
        if (!prstatus.pr_fpvalid) {
                numnote--;
        } else {
-               notes[3].name = "CORE";
-               notes[3].type = NT_PRFPREG;
-               notes[3].datasz = sizeof(fpu);
-               notes[3].data = &fpu;
+               notes[2].name = "CORE";
+               notes[2].type = NT_PRFPREG;
+               notes[2].datasz = sizeof(fpu);
+               notes[2].data = &fpu;
        }
 
        /* Write notes phdr entry. */