Commit 81ff3478 authored by Robert Richter's avatar Robert Richter

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:

 913050b9 oprofile: Fix uninitialized memory access when writing to writing to oprofilefs

Cc: stable@vger.kernel.org  # 3.3+
Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
parent fea7a08a
...@@ -169,7 +169,7 @@ static ssize_t hw_interval_write(struct file *file, char const __user *buf, ...@@ -169,7 +169,7 @@ static ssize_t hw_interval_write(struct file *file, char const __user *buf,
if (*offset) if (*offset)
return -EINVAL; return -EINVAL;
retval = oprofilefs_ulong_from_user(&val, buf, count); retval = oprofilefs_ulong_from_user(&val, buf, count);
if (retval) if (retval <= 0)
return retval; return retval;
if (val < oprofile_min_interval) if (val < oprofile_min_interval)
oprofile_hw_interval = 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, ...@@ -212,7 +212,7 @@ static ssize_t hwsampler_zero_write(struct file *file, char const __user *buf,
return -EINVAL; return -EINVAL;
retval = oprofilefs_ulong_from_user(&val, buf, count); retval = oprofilefs_ulong_from_user(&val, buf, count);
if (retval) if (retval <= 0)
return retval; return retval;
if (val != 0) if (val != 0)
return -EINVAL; return -EINVAL;
...@@ -243,7 +243,7 @@ static ssize_t hwsampler_kernel_write(struct file *file, char const __user *buf, ...@@ -243,7 +243,7 @@ static ssize_t hwsampler_kernel_write(struct file *file, char const __user *buf,
return -EINVAL; return -EINVAL;
retval = oprofilefs_ulong_from_user(&val, buf, count); retval = oprofilefs_ulong_from_user(&val, buf, count);
if (retval) if (retval <= 0)
return retval; return retval;
if (val != 0 && val != 1) if (val != 0 && val != 1)
...@@ -278,7 +278,7 @@ static ssize_t hwsampler_user_write(struct file *file, char const __user *buf, ...@@ -278,7 +278,7 @@ static ssize_t hwsampler_user_write(struct file *file, char const __user *buf,
return -EINVAL; return -EINVAL;
retval = oprofilefs_ulong_from_user(&val, buf, count); retval = oprofilefs_ulong_from_user(&val, buf, count);
if (retval) if (retval <= 0)
return retval; return retval;
if (val != 0 && val != 1) if (val != 0 && val != 1)
...@@ -317,7 +317,7 @@ static ssize_t timer_enabled_write(struct file *file, char const __user *buf, ...@@ -317,7 +317,7 @@ static ssize_t timer_enabled_write(struct file *file, char const __user *buf,
return -EINVAL; return -EINVAL;
retval = oprofilefs_ulong_from_user(&val, buf, count); retval = oprofilefs_ulong_from_user(&val, buf, count);
if (retval) if (retval <= 0)
return retval; return retval;
if (val != 0 && val != 1) if (val != 0 && val != 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment