Skip to contentSkip to conversation

coccinelle: api: add kvfree script

PATCH Julia Lawall 1 participant 1 message Aug 2, 2020 1 message not in the archive Kernel janitors

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 16 lines · Markus Elfring

…

Quoted 1 line

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

…

Quoted 6 lines

+@choice@

(quoted diff) +5 -0
+expression E, E1;
+position kok, vok;
+@@
+
+(

…

Review

Quoted 6 lines

+|

(quoted diff) +5 -0
+  E = \(kmalloc\|kzalloc\|krealloc\|kcalloc\|kmalloc_node\|kzalloc_node\|
+        kmalloc_array\|kmalloc_array_node\|kcalloc_node\)(...)@kok
+  ... when != E = E1
+      when any
+  if (\(!E\|E == NULL\)) {
Quoted 6 lines

…

Can the SmPL code exclusion specification be incomplete here?

How do you think about to check also if the memory is passed to any function (or macro) calls before the shown detection of a null pointer?

It seems both extremely unlikely and not relevant to the question at hand. Passing E to another function will not change the value of E itself. Passing &E to another function could change E, but it would be very unusual to do that, and doesn't seem worth checking for.

julia