diff options
author | Robert Richter <robert.richter@amd.com> | 2012-07-19 18:28:26 +0200 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2012-08-27 14:49:23 +0200 |
commit | 81ff3478d9ba7f0b48b0abef740e542fd83adf79 (patch) | |
tree | 46e7dcdba46426a298893946664003fe44d5bda3 /arch/s390/oprofile | |
parent | fea7a08acb13524b47711625eebea40a0ede69a0 (diff) | |
download | linux-81ff3478d9ba7f0b48b0abef740e542fd83adf79.tar.gz linux-81ff3478d9ba7f0b48b0abef740e542fd83adf79.tar.bz2 linux-81ff3478d9ba7f0b48b0abef740e542fd83adf79.zip |
oprofile, s390: Fix uninitialized memory access when writing to oprofilefs
If oprofilefs_ulong_from_user() is called with count equals zero, *val
remains unchanged. Depending on the implementation it might be
uninitialized. Fixing users of oprofilefs_ulong_ from_user().
We missed these s390 changes with:
913050b oprofile: Fix uninitialized memory access when writing to writing to oprofilefs
Cc: stable@vger.kernel.org # 3.3+
Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'arch/s390/oprofile')
-rw-r--r-- | arch/s390/oprofile/init.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c index a1e9d69a9c90..584b93674ea4 100644 --- a/arch/s390/oprofile/init.c +++ b/arch/s390/oprofile/init.c @@ -169,7 +169,7 @@ static ssize_t hw_interval_write(struct file *file, char const __user *buf, if (*offset) return -EINVAL; retval = oprofilefs_ulong_from_user(&val, buf, count); - if (retval) + if (retval <= 0) return retval; if (val < oprofile_min_interval) oprofile_hw_interval = oprofile_min_interval; @@ -212,7 +212,7 @@ static ssize_t hwsampler_zero_write(struct file *file, char const __user *buf, return -EINVAL; retval = oprofilefs_ulong_from_user(&val, buf, count); - if (retval) + if (retval <= 0) return retval; if (val != 0) return -EINVAL; @@ -243,7 +243,7 @@ static ssize_t hwsampler_kernel_write(struct file *file, char const __user *buf, return -EINVAL; retval = oprofilefs_ulong_from_user(&val, buf, count); - if (retval) + if (retval <= 0) return retval; if (val != 0 && val != 1) @@ -278,7 +278,7 @@ static ssize_t hwsampler_user_write(struct file *file, char const __user *buf, return -EINVAL; retval = oprofilefs_ulong_from_user(&val, buf, count); - if (retval) + if (retval <= 0) return retval; if (val != 0 && val != 1) @@ -317,7 +317,7 @@ static ssize_t timer_enabled_write(struct file *file, char const __user *buf, return -EINVAL; retval = oprofilefs_ulong_from_user(&val, buf, count); - if (retval) + if (retval <= 0) return retval; if (val != 0 && val != 1) |