public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mtk dot manpages at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/12083] New: aio_init() treatment of aio_num argument looks buggy
Date: Sat, 02 Oct 2010 05:41:00 -0000	[thread overview]
Message-ID: <20101002054042.12083.mtk.manpages@gmail.com> (raw)

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.


                 reply	other threads:[~2010-10-02  5:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101002054042.12083.mtk.manpages@gmail.com \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).