This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/12083] New: aio_init() treatment of aio_num argument looks buggy


In sysdeps/pthread/aio_misc.c::__aio_init(), there are the following lines
dealing with the aio_num field of the provided aioinit structure argument:

  if (pool == NULL)
    {
      optim.aio_threads = init->aio_threads < 1 ? 1 : init->aio_threads;
      optim.aio_num = (init->aio_num < ENTRIES_PER_ROW
                       ? ENTRIES_PER_ROW
                       : init->aio_num & ~ENTRIES_PER_ROW);
    }

ENTRIES_PER_ROW is 32.

This looks buggy. If init->aio_num is < 32, then the value 32 is used. That
seems sensible. But if values greater than 32 are used, then the bit mask for 32
is ANDed out of the result, so that if, for example, init->aio_num is specified
as 33, then the value 1 is assigned to optim.aio_num. Looking at the rest of the
code, this doesn't appear to make sense. (The glibc info page provides no info
on the intended behavior here.)

-- 
           Summary: aio_init() treatment of aio_num argument looks buggy
           Product: glibc
           Version: 2.12
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper dot fsp at gmail dot com
        ReportedBy: mtk dot manpages at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=12083

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]