[PATCH 2/2] kernel/sys.c: remove useless variable 'old_fsuid' forsetfsuid()

From: Chen Gang
Date: Tue Aug 06 2013 - 04:18:09 EST


Remove useless variable 'old_fsuid' to make code clearer for readers.

Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx>
---
kernel/sys.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index 558ccdb..e3983b2 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -728,11 +728,9 @@ SYSCALL_DEFINE1(setfsuid, uid_t, uid)
{
const struct cred *old;
struct cred *new;
- uid_t old_fsuid;
kuid_t kuid;

old = current_cred();
- old_fsuid = from_kuid_munged(old->user_ns, old->fsuid);

kuid = make_kuid(old->user_ns, uid);
if (!uid_valid(kuid))
@@ -747,17 +745,17 @@ SYSCALL_DEFINE1(setfsuid, uid_t, uid)
nsown_capable(CAP_SETUID)) {
if (!uid_eq(kuid, old->fsuid)) {
new->fsuid = kuid;
- if (security_task_fix_setuid(new, old, LSM_SETID_FS) == 0)
- goto change_okay;
+ if (security_task_fix_setuid(new,
+ old, LSM_SETID_FS) == 0) {
+ commit_creds(new);
+ return from_kuid_munged(old->user_ns,
+ old->fsuid);
+ }
}
}

abort_creds(new);
return uid;
-
-change_okay:
- commit_creds(new);
- return old_fsuid;
}

/*
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/