Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Benes <mbenes@suse.cz>2018-12-11 12:18:28 +0100
committerMiroslav Benes <mbenes@suse.cz>2018-12-11 12:18:28 +0100
commit76fa1a42d05db3cb21e3fbc0b5ccece8dee12f7e (patch)
treeff84effbd6dd43ee27c4a1fa4ff6769ade16647e
parentbd113d8b6ae8a9d5bb463256923026051ee2697a (diff)
parentd4e00de0b0a3f858fec4e83640f12e1f17298667 (diff)
Merge branch 'master' into master-livepatch
-rw-r--r--uname_patch/livepatch_uname.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/uname_patch/livepatch_uname.c b/uname_patch/livepatch_uname.c
index fdd11cc..4ca603a 100644
--- a/uname_patch/livepatch_uname.c
+++ b/uname_patch/livepatch_uname.c
@@ -108,23 +108,23 @@ out:
asmlinkage long klp_sys_newuname(struct new_utsname __user *name)
{
- int errno = 0;
+ struct new_utsname tmp;
char klp_version[65] = { 0 };
down_read(klp_uts_sem);
- if (copy_to_user(name, utsname(), sizeof *name))
- errno = -EFAULT;
+ memcpy(&tmp, utsname(), sizeof(tmp));
memcpy(klp_version, utsname()->version, sizeof(utsname()->version));
up_read(klp_uts_sem);
+ if (copy_to_user(name, &tmp, sizeof(tmp)))
+ return -EFAULT;
- if (!errno && override_release(name->release, sizeof(name->release)))
- errno = -EFAULT;
- if (!errno && override_architecture(name))
- errno = -EFAULT;
- if (!errno && override_version(name->version, sizeof(name->version),
- klp_version))
- errno = -EFAULT;
- return errno;
+ if (override_release(name->release, sizeof(name->release)))
+ return -EFAULT;
+ if (override_architecture(name))
+ return -EFAULT;
+ if (override_version(name->version, sizeof(name->version), klp_version))
+ return -EFAULT;
+ return 0;
}
int klp_patch_uname_init(void)