|
@@ -119,19 +119,22 @@ int get_callchain_buffers(int event_max_stack)
|
|
|
goto exit;
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ * If requesting per event more than the global cap,
|
|
|
+ * return a different error to help userspace figure
|
|
|
+ * this out.
|
|
|
+ *
|
|
|
+ * And also do it here so that we have &callchain_mutex held.
|
|
|
+ */
|
|
|
+ if (event_max_stack > sysctl_perf_event_max_stack) {
|
|
|
+ err = -EOVERFLOW;
|
|
|
+ goto exit;
|
|
|
+ }
|
|
|
+
|
|
|
if (count > 1) {
|
|
|
/* If the allocation failed, give up */
|
|
|
if (!callchain_cpus_entries)
|
|
|
err = -ENOMEM;
|
|
|
- /*
|
|
|
- * If requesting per event more than the global cap,
|
|
|
- * return a different error to help userspace figure
|
|
|
- * this out.
|
|
|
- *
|
|
|
- * And also do it here so that we have &callchain_mutex held.
|
|
|
- */
|
|
|
- if (event_max_stack > sysctl_perf_event_max_stack)
|
|
|
- err = -EOVERFLOW;
|
|
|
goto exit;
|
|
|
}
|
|
|
|