public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12083] New: aio_init() treatment of aio_num argument looks buggy
@ 2010-10-02  5:41 mtk dot manpages at gmail dot com
  0 siblings, 0 replies; only message in thread
From: mtk dot manpages at gmail dot com @ 2010-10-02  5:41 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-10-02  5:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-02  5:41 [Bug libc/12083] New: aio_init() treatment of aio_num argument looks buggy mtk dot manpages at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).