diff options
| -rw-r--r-- | fs/resctrl/rdtgroup.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 3020f4428b4e..72347d11f0da 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -1299,14 +1299,20 @@ static ssize_t max_threshold_occ_write(struct kernfs_open_file *of, unsigned int bytes; int ret; - ret = kstrtouint(buf, 0, &bytes); - if (ret) - return ret; - if (!info_kn_lock(of->kn)) return -ENOENT; + rdt_last_cmd_clear(); + + ret = kstrtouint(buf, 0, &bytes); + if (ret) { + rdt_last_cmd_puts("max_threshold_occupancy: Invalid input\n"); + goto out_unlock; + } + if (bytes > resctrl_rmid_realloc_limit) { + rdt_last_cmd_printf("max_threshold_occupancy: Exceeds limit (before adjustment) of %u bytes\n", + resctrl_rmid_realloc_limit); ret = -EINVAL; goto out_unlock; } |
