Re: [PATCH v2 1/2] xen/list: avoid UB in list iterators

2025-02-20 Thread Oleksii Kurochko
On 2/20/25 2:38 AM, Stefano Stabellini wrote: On Wed, 19 Feb 2025, Andrew Cooper wrote: On 19/02/2025 2:18 pm, Juergen Gross wrote: The list_for_each_entry*() iterators are testing for having reached the end of the list in a way which relies on undefined behavior: the iterator (being a pointer

Re: [PATCH v2 1/2] xen/list: avoid UB in list iterators

2025-02-19 Thread Stefano Stabellini
On Wed, 19 Feb 2025, Andrew Cooper wrote: > On 19/02/2025 2:18 pm, Juergen Gross wrote: > > The list_for_each_entry*() iterators are testing for having reached the > > end of the list in a way which relies on undefined behavior: the > > iterator (being a pointer to the struct of a list element) is

Re: [PATCH v2 1/2] xen/list: avoid UB in list iterators

2025-02-19 Thread Andrew Cooper
On 19/02/2025 2:18 pm, Juergen Gross wrote: > The list_for_each_entry*() iterators are testing for having reached the > end of the list in a way which relies on undefined behavior: the > iterator (being a pointer to the struct of a list element) is advanced > and only then tested to have reached no

[PATCH v2 1/2] xen/list: avoid UB in list iterators

2025-02-19 Thread Juergen Gross
The list_for_each_entry*() iterators are testing for having reached the end of the list in a way which relies on undefined behavior: the iterator (being a pointer to the struct of a list element) is advanced and only then tested to have reached not the next element, but the list head. This results