mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 09:41:03 +02:00
iommu/vt-d: Use kstrtoint_from_user() in dmar_perf_latency_write()
Simplify 'dmar_perf_latency_write()' by using the convenient 'kstrtoint_from_user()'. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
This commit is contained in:
parent
3846e469c1
commit
1251ade0e3
|
|
@ -690,19 +690,11 @@ static ssize_t dmar_perf_latency_write(struct file *filp,
|
|||
{
|
||||
struct dmar_drhd_unit *drhd;
|
||||
struct intel_iommu *iommu;
|
||||
int counting;
|
||||
char buf[64];
|
||||
int ret, counting;
|
||||
|
||||
if (cnt > 63)
|
||||
cnt = 63;
|
||||
|
||||
if (copy_from_user(&buf, ubuf, cnt))
|
||||
return -EFAULT;
|
||||
|
||||
buf[cnt] = 0;
|
||||
|
||||
if (kstrtoint(buf, 0, &counting))
|
||||
return -EINVAL;
|
||||
ret = kstrtoint_from_user(ubuf, cnt, 0, &counting);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
switch (counting) {
|
||||
case 0:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user