[PATCH 2/4] alpha: Move two assignments for the variable "error" in osf_utsname()

From: SF Markus Elfring
Date: Wed Jan 18 2017 - 06:50:01 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Jan 2017 11:10:03 +0100

A local variable was set to an error code in one case before a concrete
error situation was detected. Thus move the corresponding assignment into
an if branch to indicate a software failure there.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
arch/alpha/kernel/osf_sys.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 41174156a676..73ff5d698591 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -528,20 +528,14 @@ SYSCALL_DEFINE1(osf_utsname, char __user *, name)
int error;

down_read(&uts_sem);
- error = -EFAULT;
- if (copy_to_user(name + 0, utsname()->sysname, 32))
- goto out;
- if (copy_to_user(name + 32, utsname()->nodename, 32))
- goto out;
- if (copy_to_user(name + 64, utsname()->release, 32))
- goto out;
- if (copy_to_user(name + 96, utsname()->version, 32))
- goto out;
- if (copy_to_user(name + 128, utsname()->machine, 32))
- goto out;
-
- error = 0;
- out:
+ if (copy_to_user(name + 0, utsname()->sysname, 32) ||
+ copy_to_user(name + 32, utsname()->nodename, 32) ||
+ copy_to_user(name + 64, utsname()->release, 32) ||
+ copy_to_user(name + 96, utsname()->version, 32) ||
+ copy_to_user(name + 128, utsname()->machine, 32))
+ error = -EFAULT;
+ else
+ error = 0;
up_read(&uts_sem);
return error;
}
--
2.11.0

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