akaros/scripts/spatch/malloc.cocci
<<
>>
Prefs
   1@ rulesm @
   2identifier t;
   3identifier f;
   4expression E1;
   5type T;
   6@@
   7T f(...){<...
   8t = smalloc(E1);
   9...>}
  10@@
  11identifier rulesm.f;
  12expression E1;
  13@@
  14
  15- smalloc(E1
  16+ kzmalloc(E1, KERN_WAIT
  17   )
  18
  19@ rulem @
  20identifier t;
  21identifier f;
  22expression E1;
  23type T;
  24@@
  25T f(...){<...
  26t = malloc(E1);
  27...>}
  28@@
  29identifier rulem.f;
  30expression E1;
  31@@
  32
  33- malloc(E1
  34+ kzmalloc(E1, KERN_WAIT
  35   )
  36
  37@@
  38@@
  39-getcallerpc(...);
  40
  41@@
  42@@
  43-setmalloctag(...);
  44
  45@@
  46@@
  47-free(
  48+kfree(
  49...);
  50
  51@@
  52@@
  53-mallocz(
  54+kzmalloc(
  55...);
  56
  57@@
  58expression E1;
  59@@
  60-allocb(E1
  61+block_alloc(E1, MEM_WAIT
  62 )
  63
  64@@
  65expression E1;
  66@@
  67-iallocb(E1
  68+block_alloc(E1, MEM_ATOMIC
  69 )
  70