summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Burri <markus.burri@mt.com>2025-05-08 15:06:08 +0200
committerJacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>2025-05-12 15:12:44 +0200
commit2f0c6fceae0df59a9c0edb5d41529b90ee9f2fcb (patch)
tree75b2557f2f634ec460089cf438df8ff73ca9e149
parent9c1798259b9420f38f1fa1b83e3d864c3eb1a83e (diff)
accel/ivpu: Use effective buffer size for zero terminator
Use the effective written size instead of original size as index for zero termination. If the input from user-space is to larger and the input is truncated, the original size is out-of-bound. Since there is an upfront size check here, the change is for consistency. Signed-off-by: Markus Burri <markus.burri@mt.com> Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> Link: https://lore.kernel.org/r/20250508130612.82270-3-markus.burri@mt.com
-rw-r--r--drivers/accel/ivpu/ivpu_debugfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/accel/ivpu/ivpu_debugfs.c b/drivers/accel/ivpu/ivpu_debugfs.c
index f0dad0c9ce33..cd24ccd20ba6 100644
--- a/drivers/accel/ivpu/ivpu_debugfs.c
+++ b/drivers/accel/ivpu/ivpu_debugfs.c
@@ -455,7 +455,7 @@ priority_bands_fops_write(struct file *file, const char __user *user_buf, size_t
if (ret < 0)
return ret;
- buf[size] = '\0';
+ buf[ret] = '\0';
ret = sscanf(buf, "%u %u %u %u", &band, &grace_period, &process_grace_period,
&process_quantum);
if (ret != 4)