lkml.org 
[lkml]   [2010]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 0/6] improve list_sort test
From
Date
On Sun, 2010-08-08 at 13:07 -0700, Don Mullis wrote:
> On Sun, Aug 8, 2010 at 12:31 PM, Don Mullis <don.mullis@gmail.com> wrote:
> > Artem Bityutskiy <dedekind1@gmail.com> writes:
> >> Actually, your 'list_sort()' version does have a problem. I found out
> >> that it calls 'cmp(priv, a, b)' with 'a = b' sometimes, and in these
> >> cases 'a' and 'b' can point to something which is not a valid element of
> >> the original list. Probably a senitel or something like that.
>
> Looks like if the original list is a POT in length, the first callback
> from line 73 will pass a==b both pointing to the original list_head.
> Would you be able to test this fix?
>
> --- linux-2.6.orig/lib/list_sort.c
> +++ linux-2.6/lib/list_sort.c
> @@ -70,7 +70,7 @@ static void merge_and_restore_back_links
> * element comparison is needed, so the client's cmp()
> * routine can invoke cond_resched() periodically.
> */
> - (*cmp)(priv, tail, tail);
> + (*cmp)(priv, tail->next, tail->next);
>
> tail->next->prev = tail;
> tail = tail->next;

Hi, thanks. I'm out of office, and probably will be able to do this few
weeks later.

Artem.



\
 
 \ /
  Last update: 2010-08-09 08:03    [W:0.128 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site