Skip to content

Commit

Permalink
platform/x86: intel_telemetry_debugfs: Respect error code of kstrtou3…
Browse files Browse the repository at this point in the history
…2_from_user()

kstrtou32_from_user() may return different error codes on certain
circumstances. Respect all possible values.

Signed-off-by: Andy Shevchenko <[email protected]>
  • Loading branch information
andy-shev committed Jan 10, 2020
1 parent cbe3581 commit 4475e69
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/platform/x86/intel_telemetry_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,13 +686,14 @@ static ssize_t telem_pss_trc_verb_write(struct file *file,
u32 verbosity;
int err;

if (kstrtou32_from_user(userbuf, count, 0, &verbosity))
return -EFAULT;
err = kstrtou32_from_user(userbuf, count, 0, &verbosity);
if (err)
return err;

err = telemetry_set_trace_verbosity(TELEM_PSS, verbosity);
if (err) {
pr_err("Changing PSS Trace Verbosity Failed. Error %d\n", err);
count = err;
return err;
}

return count;
Expand Down Expand Up @@ -733,13 +734,14 @@ static ssize_t telem_ioss_trc_verb_write(struct file *file,
u32 verbosity;
int err;

if (kstrtou32_from_user(userbuf, count, 0, &verbosity))
return -EFAULT;
err = kstrtou32_from_user(userbuf, count, 0, &verbosity);
if (err)
return err;

err = telemetry_set_trace_verbosity(TELEM_IOSS, verbosity);
if (err) {
pr_err("Changing IOSS Trace Verbosity Failed. Error %d\n", err);
count = err;
return err;
}

return count;
Expand Down

0 comments on commit 4475e69

Please sign in to comment.