Skip to contentSkip to conversation

linux-next: kernel/trace/ring_buffer.c

DISCUSSION Colin King (gmail) 1 participant 1 message Oct 21, 2024

lore
Share & tools
lore
#0 lore raw

Hi,

Static analysis on today's linux next found an issue in kernel/trace/ring_buffer.c in line 1538, after a raw_spin_unlock_irqrestore() call. There is a return statement on line 1538 so that all subsequent code is not being executed, which doesn't look correct. Not sure what the return is doing, perhaps is a consequence of a mis-merge of code.

Colin

commit id line source
1f1c2bc9d0753 1527) again:
1f1c2bc9d0753 1528) if (++nr_loops > 3)
b4b55dfd96505 1529) return;
7a8e76a3829f1 1530)

1f1c2bc9d0753 1531)      raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
1f1c2bc9d0753 1532)      head = rb_list_head(cpu_buffer->pages);
1f1c2bc9d0753 1533)      if (!rb_check_links(cpu_buffer, head))

1f1c2bc9d0753 1534) goto out_locked;
1f1c2bc9d0753 1535) buffer_cnt = cpu_buffer->cnt;
1f1c2bc9d0753 1536) tmp = head;
1f1c2bc9d0753 1537) raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
b4b55dfd96505 1538) return; /// <- issue HERE
77ae365eca895 1539)
1f1c2bc9d0753 1540) while (true) {
1f1c2bc9d0753 1541) raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags); 8843e06f67b14 1542)
1f1c2bc9d0753 1543) if (buffer_cnt != cpu_buffer->cnt) {
1f1c2bc9d0753 1544) /* The list was updated, try again. */
1f1c2bc9d0753 1545) raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
1f1c2bc9d0753 1546) goto again;
1f1c2bc9d0753 1547) }
1f1c2bc9d0753 1548)
1f1c2bc9d0753 1549) tmp = rb_list_head(tmp->next);
1f1c2bc9d0753 1550) if (tmp == head)
1f1c2bc9d0753 1551) /* The iteration circled back, all is done. */
1f1c2bc9d0753 1552) goto out_locked;
1f1c2bc9d0753 1553)
1f1c2bc9d0753 1554) if (!rb_check_links(cpu_buffer, tmp))
1f1c2bc9d0753 1555) goto out_locked;
1f1c2bc9d0753 1556)
1f1c2bc9d0753 1557) raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
7a8e76a3829f1 1558) }