Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: [OMPI devel] Unchecked malloc()'s in OMPI 1.4.x
From: Christopher Samuel (samuel_at_[hidden])
Date: 2010-05-02 23:09:37


Hi there,

I've been playing around with Coccinelle, the semantic
patching system (packaged in Ubuntu 10.04) and using it
to try and detect things like unchecked malloc(). It's
not perfect, for instance it flags up calls to assert()
on the result of the malloc as bad, even though they're
not, but the rest seem real.

I've done a test run on OMPI 1.4.2rc3r23065 and it's
flagged the following, I hope these are useful!

ompi/mca/btl/openib/btl_openib_component.c
line 997 - prepare_device_for_use()

     init_data = malloc(sizeof(mca_btl_openib_frag_init_data_t));

ompi/mca/btl/openib/btl_openib_component.c
line 2414 - btl_openib_component_init()

      init_data = malloc(sizeof(mca_btl_openib_frag_init_data_t));

ompi/mca/btl/openib/connect/btl_openib_connect_base.c
line 104 - prepare_device_for_use()

     available = calloc(1, sizeof(all));

ompi/mca/btl/portals/btl_portals.c
line 104 - mca_btl_portals_add_procs()

      portals_procs = malloc(nprocs * sizeof(ptl_process_id_t));

ompi/mpi/f77/comm_spawn_multiple_f.c
line 109 - mpi_comm_spawn_multiple_f()

     c_info = malloc (array_size * sizeof(MPI_Info));

opal/class/opal_hash_table.c
line 431 - opal_hash_table_set_value_ptr()

     node->hn_key = malloc(key_size);

orte/mca/ras/alps/ras_alps_module.c
line 243 - orte_ras_alps_read_appinfo_file()

         cpBuf=malloc(szLen+1); /* Allocate buffer
        */

All the best,
Chris

-- 
  Christopher Samuel - Senior Systems Administrator
  VLSCI - Victorian Life Sciences Computational Initiative
  Email: samuel_at_[hidden] Phone: +61 (0)3 903 55545
          http://www.vlsci.unimelb.edu.au/