patch-2.1.37 linux/fs/binfmt_elf.c

Next file: linux/fs/buffer.c
Previous file: linux/fs/autofs/waitq.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.36/linux/fs/binfmt_elf.c linux/fs/binfmt_elf.c
@@ -210,14 +210,16 @@
 
 	/* Now read in all of the header information */
 
-	if (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > PAGE_SIZE)
+	if (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > PAGE_SIZE) {
 	    return ~0UL;
+	}
 
 	elf_phdata =  (struct elf_phdr *)
 		kmalloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum,
 			GFP_KERNEL);
-	if (!elf_phdata)
+	if (!elf_phdata) {
 	  return ~0UL;
+	}
 
 	/*
 	 * If the size of this structure has changed, then punt, since
@@ -278,6 +280,7 @@
 	      /* Real error */
 	      sys_close(elf_exec_fileno);
 	      kfree(elf_phdata);
+printk("%d", error);
 	      return ~0UL;
 	    }
 
@@ -359,7 +362,9 @@
 	    interp_ex->a_bss,
 	    PROT_READ|PROT_WRITE|PROT_EXEC,
 	    MAP_FIXED|MAP_PRIVATE, 0);
-  if (retval < 0) return ~0UL;
+  if (retval < 0) {
+  	return ~0UL;
+  }
   return elf_entry;
 }
 
@@ -1154,7 +1159,8 @@
 		set_fs(fs);
 
 		len = current->mm->arg_end - current->mm->arg_start;
-		len = len >= ELF_PRARGSZ ? ELF_PRARGSZ : len;
+		if (len >= ELF_PRARGSZ)
+			len = ELF_PRARGSZ-1;
 		copy_from_user(&psinfo.pr_psargs,
 			      (const char *)current->mm->arg_start, len);
 		for(i = 0; i < len; i++)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov