> +     len = sprintf(buf, "%d\n", READ_ONCE(*field));

READ_ONCE isn't necessary as there is only one read being made.

> +     len = min(count, sizeof(buf) - 1);
> +     if (copy_from_user(buf, user_buf, len))
> +             return -EFAULT;
> +
> +     buf[len] = '\0';
> +     if (kstrtouint(buf, 0, &enable))
> +             return -EINVAL;

There is kstrto*_from_user().

Reply via email to