Skip to content

Commit 2f0c6fc

Browse files
Markus Burrijlawryno
authored andcommitted
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
1 parent 9c17982 commit 2f0c6fc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/accel/ivpu/ivpu_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ priority_bands_fops_write(struct file *file, const char __user *user_buf, size_t
455455
if (ret < 0)
456456
return ret;
457457

458-
buf[size] = '\0';
458+
buf[ret] = '\0';
459459
ret = sscanf(buf, "%u %u %u %u", &band, &grace_period, &process_grace_period,
460460
&process_quantum);
461461
if (ret != 4)

0 commit comments

Comments
 (0)