+ uml-error-handling-fixes.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     uml: error handling fixes

has been added to the -mm tree.  Its filename is

     uml-error-handling-fixes.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this


From: Jeff Dike <jdike@xxxxxxxxxxx>

Blairsorblade noticed some confusion between our use of a system
call's return value and errno.  This patch fixes a number of related
bugs -
	using errno instead of a return value
	using a return value instead of errno
	forgetting to negate a error return to get a positive error code

Signed-off-by: Jeff Dike <jdike@xxxxxxxxxxx>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 arch/um/os-Linux/file.c                 |    2 +-
 arch/um/os-Linux/skas/process.c         |    6 +++---
 arch/um/os-Linux/sys-i386/registers.c   |    4 ++--
 arch/um/os-Linux/sys-x86_64/registers.c |    4 ++--
 arch/um/os-Linux/umid.c                 |    4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff -puN arch/um/os-Linux/file.c~uml-error-handling-fixes arch/um/os-Linux/file.c
--- 25/arch/um/os-Linux/file.c~uml-error-handling-fixes	Fri Apr 28 16:55:59 2006
+++ 25-akpm/arch/um/os-Linux/file.c	Fri Apr 28 16:55:59 2006
@@ -171,7 +171,7 @@ int os_sigio_async(int master, int slave
 
 	flags = fcntl(master, F_GETFL);
 	if(flags < 0)
-		return errno;
+		return -errno;
 
 	if((fcntl(master, F_SETFL, flags | O_NONBLOCK | O_ASYNC) < 0) ||
 	   (fcntl(master, F_SETOWN, os_getpid()) < 0))
diff -puN arch/um/os-Linux/skas/process.c~uml-error-handling-fixes arch/um/os-Linux/skas/process.c
--- 25/arch/um/os-Linux/skas/process.c~uml-error-handling-fixes	Fri Apr 28 16:55:59 2006
+++ 25-akpm/arch/um/os-Linux/skas/process.c	Fri Apr 28 16:55:59 2006
@@ -344,12 +344,12 @@ int copy_context_skas0(unsigned long new
 	err = ptrace_setregs(pid, regs);
 	if(err < 0)
 		panic("copy_context_skas0 : PTRACE_SETREGS failed, "
-		      "pid = %d, errno = %d\n", pid, errno);
+		      "pid = %d, errno = %d\n", pid, -err);
 
 	err = ptrace_setfpregs(pid, fp_regs);
 	if(err < 0)
 		panic("copy_context_skas0 : PTRACE_SETFPREGS failed, "
-		      "pid = %d, errno = %d\n", pid, errno);
+		      "pid = %d, errno = %d\n", pid, -err);
 
 	/* set a well known return code for detection of child write failure */
 	child_data->err = 12345678;
@@ -362,7 +362,7 @@ int copy_context_skas0(unsigned long new
 	pid = data->err;
 	if(pid < 0)
 		panic("copy_context_skas0 - stub-parent reports error %d\n",
-		      pid);
+		      -pid);
 
 	/* Wait, until child has finished too: read child's result from
 	 * child's stack and check it.
diff -puN arch/um/os-Linux/sys-i386/registers.c~uml-error-handling-fixes arch/um/os-Linux/sys-i386/registers.c
--- 25/arch/um/os-Linux/sys-i386/registers.c~uml-error-handling-fixes	Fri Apr 28 16:55:59 2006
+++ 25-akpm/arch/um/os-Linux/sys-i386/registers.c	Fri Apr 28 16:55:59 2006
@@ -104,7 +104,7 @@ void init_registers(int pid)
 	err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
 	if(err)
 		panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
-		      err);
+		      errno);
 
 	errno = 0;
 	err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs);
@@ -119,7 +119,7 @@ void init_registers(int pid)
 	err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
 	if(err)
 		panic("check_ptrace : PTRACE_GETFPREGS failed, errno = %d",
-		      err);
+		      errno);
 }
 
 void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
diff -puN arch/um/os-Linux/sys-x86_64/registers.c~uml-error-handling-fixes arch/um/os-Linux/sys-x86_64/registers.c
--- 25/arch/um/os-Linux/sys-x86_64/registers.c~uml-error-handling-fixes	Fri Apr 28 16:55:59 2006
+++ 25-akpm/arch/um/os-Linux/sys-x86_64/registers.c	Fri Apr 28 16:55:59 2006
@@ -62,12 +62,12 @@ void init_registers(int pid)
 	err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
 	if(err)
 		panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
-		      err);
+		      errno);
 
 	err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
 	if(err)
 		panic("check_ptrace : PTRACE_GETFPREGS failed, errno = %d",
-		      err);
+		      errno);
 }
 
 void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
diff -puN arch/um/os-Linux/umid.c~uml-error-handling-fixes arch/um/os-Linux/umid.c
--- 25/arch/um/os-Linux/umid.c~uml-error-handling-fixes	Fri Apr 28 16:55:59 2006
+++ 25-akpm/arch/um/os-Linux/umid.c	Fri Apr 28 16:55:59 2006
@@ -178,14 +178,14 @@ static void __init create_pid_file(void)
 	fd = open(file, O_RDWR | O_CREAT | O_EXCL, 0644);
 	if(fd < 0){
 		printk("Open of machine pid file \"%s\" failed: %s\n",
-		       file, strerror(-fd));
+		       file, strerror(errno));
 		return;
 	}
 
 	snprintf(pid, sizeof(pid), "%d\n", getpid());
 	n = write(fd, pid, strlen(pid));
 	if(n != strlen(pid))
-		printk("Write of pid file failed - err = %d\n", -n);
+		printk("Write of pid file failed - err = %d\n", errno);
 
 	close(fd);
 }
_

Patches currently in -mm which might be from jdike@xxxxxxxxxxx are

uml-fix-iomem-list-traversal.patch
uml-skas0-support-for-2g-2g-hosts.patch
uml-remove-null-checks-and-add-some-codingstyle.patch
uml-clean-up-after-madvise_remove.patch
uml-update-defconfig.patch
uml-error-handling-fixes.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux