mm: use ERR_CAST

Author: Julia Lawall <julia@diku.dk> Use ERR_CAST(x) rather than ERR_PTR(PTR_ERR(x)). The former makes more clear what is the purpose of the operation, which otherwise looks like a no-op. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; T x; identifier f; @@ T f (…) { } @@ expression x; …

Lire la suite

mm: use memdup_user

Author: Julia Lawall <julia@diku.dk> Use memdup_user when user data is immediately copied into the allocated region. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression from,to,size,flag; position p; identifier l1,l2; @@ – to = \(kmalloc@p\|kzalloc@p\)(size,flag); + to = memdup_user(from,size); if ( – to==NULL + IS_ERR(to) || …) { } – …

Lire la suite

UBI: eliminate update of list_for_each_entry loop cursor

Author: 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/) // @r@ …

Lire la suite

fs/ecryptfs/file.c: introduce missing free

Author: Julia Lawall <julia@diku.dk> The comments in the code indicate that file_info should be released if the function fails. This releasing is done at the label out_free, not out. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression …

Lire la suite

of/device: Replace struct of_device with struct platform_device

Author: Grant Likely <grant.likely@secretlab.ca> of_device is just an alias for platform_device, so remove it entirely. Also replace to_of_device() with to_platform_device() and update comment blocks. This patch was initially generated from the following semantic patch, and then edited by hand to pick up the bits that coccinelle didn’t catch. @@ @@ -struct of_device +struct platform_device Signed-off-by: …

Lire la suite

[media] drivers/media/video/bt8xx: Adjust confusing if indentation

Author: Julia Lawall <julia@diku.dk> Indent the branch of an if. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r disable braces4@ position p1,p2; statement S1,S2; @@ ( if (…) { … } | if (…) S1@p1 S2@p2 ) @script:python@ p1

perf timechart: Adjust confusing if indentation

Author: Julia Lawall <julia@diku.dk> Outdent the code following the if. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r disable braces4@ position p1,p2; statement S1,S2; @@ ( if (…) { … } | if (…) S1@p1 S2@p2 ) @script:python@ p1

sound/oss: Adjust confusing if indentation

Author: Julia Lawall <julia@diku.dk> Indent the branch of an if. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r disable braces4@ position p1,p2; statement S1,S2; @@ ( if (…) { … } | if (…) S1@p1 S2@p2 ) @script:python@ p1

[SCSI] drivers/message/fusion: Adjust confusing if indentation

Author: Julia Lawall <julia@diku.dk> Indent the branch of an if. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r disable braces4@ position p1,p2; statement S1,S2; @@ ( if (…) { … } | if (…) S1@p1 S2@p2 ) @script:python@ p1

drivers/net/wireless/ath/ath9k: Adjust confusing if indentation

Author: Julia Lawall <julia@diku.dk> Outdent the code following the if. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r disable braces4@ position p1,p2; statement S1,S2; @@ ( if (…) { … } | if (…) S1@p1 S2@p2 ) @script:python@ p1