All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: anton@samba.org
Cc: linuxppc-dev@lists.ozlabs.org
Subject: [bug report] powerpc/iommu: Implement IOMMU pools to improve multiqueue adapter performance
Date: Wed, 14 Aug 2019 17:19:38 +0300	[thread overview]
Message-ID: <20190814141938.GA587@mwanda> (raw)

[ Ancient code.  The warning is correct but the bug seems harmless.
  -- dan ]

Hello Anton Blanchard,

The patch b4c3a8729ae5: "powerpc/iommu: Implement IOMMU pools to
improve multiqueue adapter performance" from Jun 7, 2012, leads to
the following static checker warning:

	arch/powerpc/kernel/iommu.c:377 get_pool()
	warn: array off by one? '*tbl->pools + pool_nr'

arch/powerpc/kernel/iommu.c
   364  static struct iommu_pool *get_pool(struct iommu_table *tbl,
   365                                     unsigned long entry)
   366  {
   367          struct iommu_pool *p;
   368          unsigned long largepool_start = tbl->large_pool.start;
   369  
   370          /* The large pool is the last pool at the top of the table */
   371          if (entry >= largepool_start) {
   372                  p = &tbl->large_pool;
   373          } else {
   374                  unsigned int pool_nr = entry / tbl->poolsize;
   375  
   376                  BUG_ON(pool_nr > tbl->nr_pools);
                                       ^
This should be ">=".  The tbl->nr_pools value is either 1 or
IOMMU_NR_POOLS and the tbl->pools[] array has IOMMU_NR_POOLS elements.

   377                  p = &tbl->pools[pool_nr];
   378          }
   379  
   380          return p;
   381  }

regards,
dan carpenter

                 reply	other threads:[~2019-08-14 22:06 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=20190814141938.GA587@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.