Skip to content

Commit 66bbea9

Browse files
vdonnefortrostedt
authored andcommitted
ring-buffer: Clean ring_buffer_poll_wait() error return
The return type for ring_buffer_poll_wait() is __poll_t. This is behind the scenes an unsigned where we can set event bits. In case of a non-allocated CPU, we do return instead -EINVAL (0xffffffea). Lucky us, this ends up setting few error bits (EPOLLERR | EPOLLHUP | EPOLLNVAL), so user-space at least is aware something went wrong. Nonetheless, this is an incorrect code. Replace that -EINVAL with a proper EPOLLERR to clean that output. As this doesn't change the behaviour, there's no need to treat this change as a bug fix. Link: https://lore.kernel.org/linux-trace-kernel/[email protected] Cc: [email protected] Fixes: 6721cb6 ("ring-buffer: Do not poll non allocated cpu buffers") Signed-off-by: Vincent Donnefort <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 29142dc commit 66bbea9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/trace/ring_buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ __poll_t ring_buffer_poll_wait(struct trace_buffer *buffer, int cpu,
944944
full = 0;
945945
} else {
946946
if (!cpumask_test_cpu(cpu, buffer->cpumask))
947-
return -EINVAL;
947+
return EPOLLERR;
948948

949949
cpu_buffer = buffer->buffers[cpu];
950950
work = &cpu_buffer->irq_work;

0 commit comments

Comments
 (0)