Skip to contentSkip to conversation

coccinelle: api: add selfcheck for memdup_user rule

PATCH Markus Elfring 1 participant 1 message Jun 9, 2020 Kernel janitors

lore
Share & tools
lore
#0 lore raw

…

Review virtual patch · line 17

Quoted 6 lines

+++ b/scripts/coccinelle/api/memdup_user.cocci

(quoted diff) +1 -0
@@ -14,13 +14,24 @@ virtual patch
 virtual context
 virtual org
 virtual report
+virtual selfcheck

Would you like to avoid the repetition of a SmPL key word here?

+virtual patch, context, org, report, selfcheck

Review p << rv.p; · line 134

Quoted 8 lines
(quoted diff) +4 -0
@@ -117,3 +128,34 @@ p << rv.p;
 @@
 
 coccilib.report.print_report(p[0], "WARNING opportunity for vmemdup_user")
+
+@script:python depends on selfcheck@
+@@
+coccinelle.checked_files |= set(definitions.values()) & set(cocci.files())

I suggest to reconsider the usage of the function “cocci.files()”. Can such a script rule determine for which file it should perform data processing?

Review p << rv.p; · line 136

Quoted 2 lines
(quoted diff) +2 -0
+            print('SELF-CHECK: the pattern no longer matches ' \
+		  'definitions {} in file {}'.format(not_found, efile))

Can the following code variant be a bit nicer?

+ sys.stdout.write('SELF-CHECK: The pattern does not match definitions {} in file {} any more.\n' \
+ .format(not_found, efile))

Regards,
Markus