[Cocci] trying to understand the output of coccicheck

Brice Goglin Brice.Goglin at inria.fr
Tue May 4 11:57:08 CEST 2010


Hello,

I am trying to run coccicheck on KNEM
(http://runtime.bordeaux.inria.fr/knem/) and I can't understand what it
is complaining about. I am using coccicheck 0.2.4 (with a couple fixes
to make it work with coccinelle 0.2.2). After running, all my
results/*.out files are empty, except malloc.out (attached). I can't
believe coccicheck is telling me that I should removed the lines
mentioned in this diff patch since my malloc is certainly needed :) So I
guess I just don't understand what coccicheck is saying. Would you mind
helping me?

By the way, I had to replace all my #include "foo.h" with <foo.h> since
Coccinelle doesn't seem to find foo.h even if -I mylocaldir is properly
given to spatch. Is this a known problem?

thank you
Brice Goglin



-------------- next part --------------
diff -u -p /home/bgoglin/knem/trunk/tools/knem_collectives.c /tmp/nothing
--- /home/bgoglin/knem/trunk/tools/knem_collectives.c	2010-05-04 11:45:48.000000000 +0200
+++ /tmp/nothing
@@ -579,7 +579,6 @@ int main(int argc, char * argv[])
     goto out;
   }
 
-  pids = malloc((nprocs-1) * sizeof(*pids));
   if (!pids) {
     fprintf(stderr, "malloc pids\n");
     err = 1;
@@ -612,7 +611,6 @@ int main(int argc, char * argv[])
   fd = open("/dev/knem", O_RDWR);
   if (fd < 0) {
     perror("open");
-    goto out;
   }
 
   err = ioctl(fd, KNEM_CMD_GET_INFO, &info);
@@ -706,5 +704,4 @@ int main(int argc, char * argv[])
   free(pids);
  out:
   free(binding);
-  return err;
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: malloc.log
Type: text/x-log
Size: 644 bytes
Desc: not available
Url : http://lists.diku.dk/pipermail/cocci/attachments/20100504/791c4363/malloc.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: malloc.sh
Type: application/x-shellscript
Size: 355 bytes
Desc: not available
Url : http://lists.diku.dk/pipermail/cocci/attachments/20100504/791c4363/malloc-0001.bin


More information about the Cocci mailing list