watchdog: implement error handling for failure to set up hardware perf events
[firefly-linux-kernel-4.4.55.git] / kernel / trace / trace.c
index 77b8dc528006cf2c937b242ded546f425a1a9caf..62c6506d663fa11e79128759bd03103d12ed7c0f 100644 (file)
@@ -3353,12 +3353,12 @@ tracing_cpumask_read(struct file *filp, char __user *ubuf,
 
        mutex_lock(&tracing_cpumask_update_lock);
 
-       len = cpumask_scnprintf(mask_str, count, tr->tracing_cpumask);
-       if (count - len < 2) {
+       len = snprintf(mask_str, count, "%*pb\n",
+                      cpumask_pr_args(tr->tracing_cpumask));
+       if (len >= count) {
                count = -EINVAL;
                goto out_err;
        }
-       len += sprintf(mask_str + len, "\n");
        count = simple_read_from_buffer(ubuf, count, ppos, mask_str, NR_CPUS+1);
 
 out_err: