mirror of
https://github.com/torvalds/linux.git
synced 2026-10-23 07:11:03 +02:00
fs/resctrl: Simplify pseudo_lock_measure_trigger()
Use convenient kstrtoint_from_user() to simplify pseudo_lock_measure_trigger(). No functional changes. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Link: https://patch.msgid.link/20260821081128.19242-2-dmantipov@yandex.ru
This commit is contained in:
parent
4b31656d91
commit
a3f5e6eba4
|
|
@ -750,17 +750,10 @@ static ssize_t pseudo_lock_measure_trigger(struct file *file,
|
|||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct rdtgroup *rdtgrp = file->private_data;
|
||||
size_t buf_size;
|
||||
char buf[32];
|
||||
int ret;
|
||||
int sel;
|
||||
|
||||
buf_size = min(count, (sizeof(buf) - 1));
|
||||
if (copy_from_user(buf, user_buf, buf_size))
|
||||
return -EFAULT;
|
||||
|
||||
buf[buf_size] = '\0';
|
||||
ret = kstrtoint(buf, 10, &sel);
|
||||
ret = kstrtoint_from_user(user_buf, count, 10, &sel);
|
||||
if (ret == 0) {
|
||||
if (sel != 1 && sel != 2 && sel != 3)
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user