Skip to contentSkip to conversation

Coccinelle: memdup: fix the report mode

PATCH In review Nicolas Iooss 2 participants 2 messages Dec 27, 2016 Coccinelle/Semantic Patches (SmPL)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Coccinelle: memdup: fix the report mode

The pattern which was used in report mode included an annoying kmemdup call, which has no chance of being there. Remove this stray line.

While at it, the name of function kmemdup was misspelled in the warning message. Fix this.

Fixes 29a36d4dec6c ("scripts/coccinelle: improve the coverage of some

semantic patches")

---
 scripts/coccinelle/api/memdup.cocci | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
scripts/coccinelle/api/memdup.cocci +2 -3
index 3d1aa71b7579..8fd6437beda8 100644
@@ -49,7 +49,6 @@ statement S;
 @@
 
 *  to = \(kmalloc at p\|kzalloc at p\)(size,flag);
-   to = kmemdup(from,size,flag);
    if (to==NULL || ...) S
 *  memcpy(to, from, size);
 
@@ -57,10 +56,10 @@ statement S;
 p << r.p;
 @@
 
-coccilib.org.print_todo(p[0], "WARNING opportunity for kmemdep")
+coccilib.org.print_todo(p[0], "WARNING opportunity for kmemdup")
 
 @script:python depends on report@
 p << r.p;
 @@
 
-coccilib.report.print_report(p[0], "WARNING opportunity for kmemdep")
+coccilib.report.print_report(p[0], "WARNING opportunity for kmemdup")
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Nicolas Iooss

The pattern which was used in report mode included an annoying kmemdup call, which has no chance of being there. Remove this stray line.

While at it, the name of function kmemdup was misspelled in the warning message. Fix this.

Fixes 29a36d4dec6c ("scripts/coccinelle: improve the coverage of some

semantic patches")

Thanks for the fixes.

julia

Quoted 33 lines
---
 scripts/coccinelle/api/memdup.cocci | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
scripts/coccinelle/api/memdup.cocci +2 -4
index 3d1aa71b7579..8fd6437beda8 100644
@@ -49,7 +49,6 @@ statement S;
 @@
 
 *  to = \(kmalloc at p\|kzalloc at p\)(size,flag);
-   to = kmemdup(from,size,flag);
    if (to==NULL || ...) S
 *  memcpy(to, from, size);
 
@@ -57,10 +56,10 @@ statement S;
 p << r.p;
 @@
 
-coccilib.org.print_todo(p[0], "WARNING opportunity for kmemdep")
+coccilib.org.print_todo(p[0], "WARNING opportunity for kmemdup")
 
 @script:python depends on report@
 p << r.p;
 @@
 
-coccilib.report.print_report(p[0], "WARNING opportunity for kmemdep")
+coccilib.report.print_report(p[0], "WARNING opportunity for kmemdup")
--

2.11.0