linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [bug report] powerpc/iommu: Implement IOMMU pools to improve multiqueue adapter performance
@ 2019-08-14 14:19 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2019-08-14 14:19 UTC (permalink / raw)
  To: anton; +Cc: linuxppc-dev

[ 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

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

only message in thread, other threads:[~2019-08-14 22:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-14 14:19 [bug report] powerpc/iommu: Implement IOMMU pools to improve multiqueue adapter performance Dan Carpenter

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 NNTP newsgroup(s).