lkml.org 
[lkml]   [2010]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/2] drivers/mtd/ubi: Eliminate update of list_for_each_entry loop cursor
From
Date
On Sat, 2010-08-07 at 11:09 +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> list_for_each_entry uses its first argument to move from one element to the
> next, so modifying it can break the iteration. The variable re1 is already
> used within the loop as a temporary variable, and is not live here.
>
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @r@
> iterator name list_for_each_entry;
> expression x,E;
> position p1,p2;
> @@
>
> list_for_each_entry@p1(x,...) { <... x =@p2 E ...> }
>
> @@
> expression x,E;
> position r.p1,r.p2;
> statement S;
> @@
>
> *x =@p2 E
> ...
> list_for_each_entry@p1(x,...) S
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>

Pushed to ubi-2.6.git tree. This won't be seen in linux-next for some
time though, but I'll make it visible in linux-next at some point soon.

Thanks!

--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-08-24 14:55    [W:0.061 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site