Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: [hwloc-devel] Bug in v1.1 bitmap API
From: Bernd Kallies (kallies_at_[hidden])
Date: 2010-12-20 09:20:31


Hallo,

while browsing through the implementation of the bitmap API in hwloc 1.1
and comparing it with the cpuset API of hwloc 1.0, it turns out that
hwloc_bitmap_alloc uses malloc and leaves struct member ulongs
uninitialized, wheres 1.0 used calloc.

This leads to random bitmap content after creation with
hwloc_bitmap_alloc, depending on how system's malloc works. In addition,
these bitmaps cannot be zeroed with hwloc_bitmap_zero right after alloc.

One may check this with the call sequence

hwloc_bitmap_alloc
hwloc_bitmap_to_ulong
hwloc_bitmap_zero
hwloc_bitmap_to_ulong

I would expect that hwloc_bitmap_alloc returns a new empty bitmap, which
appears to be empty with all methods showing bitmap content, and which
can be used for logical bit manipulations without further
initialization.

I suggest to reintroduce calloc or memset in hwloc_bitmap_alloc.

Sincerely BK

-- 
Dr. Bernd Kallies
Konrad-Zuse-Zentrum für Informationstechnik Berlin
Takustr. 7
14195 Berlin
Tel: +49-30-84185-270
Fax: +49-30-84185-311
e-mail: kallies_at_[hidden]