Message ID | 20150723082414.GA30778@mwanda (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
diff --git a/ptrlist.h b/ptrlist.h index 58d3bda..61e159f 100644 --- a/ptrlist.h +++ b/ptrlist.h @@ -97,6 +97,8 @@ static inline void *last_ptr_list(struct ptr_list *list) } else { \ __list = __list->next; \ ptr = NULL; \ + while (__list->nr == 0 && __list != __head) \ + __list = __list->next; \ if (__list != __head) { \ __nr = 0; \ ptr = PTR_ENTRY(__list,0); \
If you call DELETE_CURRENT_PTR(), then you can sometimes end up with a __list->nr that is zero. The FOR_EACH_PTR() macro can handle this but the NEXT_PTR_LIST() macro returns ptr = 0xf0f0f0f0 which leads to a segfault. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- ptrlist.h | 2 ++ 1 file changed, 2 insertions(+)