Re: [PATCH] sched/debug: Validate writes to the scan_size_mb debugfs knob
From: Chen Yu
Date: Mon Aug 10 2026 - 10:00:00 EST
On Mon, Aug 10, 2026 at 04:18:29PM +0800, Zhan Xusheng wrote:
> +static ssize_t sched_numa_scan_size_write(struct file *filp,
> + const char __user *ubuf,
> + size_t cnt, loff_t *ppos)
> +{
> + unsigned int mb;
> + int ret;
> +
> + ret = kstrtouint_from_user(ubuf, cnt, 10, &mb);
>
minor
ret = kstrtouint_from_user(ubuf, cnt, 0, &mb)?
The debugfs_create_u32() path being replaced parses with base 0 via
kstrtoull(attr->set_buf, 0, &val) in simple_attr_write_xsigned(), so
base 10 makes writes like "echo 0x100 > scan_size_mb" return -EINVAL.
Others look ok to me, with above fix, per my knowledge,
Reviewed-by: Chen Yu <yu.c.chen@xxxxxxxxx>
thanks,
Chenyu