All of lore.kernel.org
 help / color / mirror / Atom feed
* Coverity: irdma_prm_get_pbles(): Integer handling issues
@ 2021-06-08 18:01 coverity-bot
  2021-06-15 15:58 ` Saleem, Shiraz
  0 siblings, 1 reply; 2+ messages in thread
From: coverity-bot @ 2021-06-08 18:01 UTC (permalink / raw)
  To: Mustafa Ismail
  Cc: Jason Gunthorpe, Shiraz Saleem, Gustavo A. R. Silva, linux-next

Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20210608 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Wed Jun 2 19:55:19 2021 -0300
    915cc7ac0f8e ("RDMA/irdma: Add miscellaneous utility definitions")

Coverity reported the following:

*** CID 1505157:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
/drivers/infiniband/hw/irdma/utils.c: 2329 in irdma_prm_get_pbles()
2323     	struct list_head *chunk_entry = pprm->clist.next;
2324     	u32 offset;
2325     	unsigned long flags;
2326     	*vaddr = 0;
2327     	*fpm_addr = 0;
2328
vvv     CID 1505157:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
vvv     Potentially overflowing expression "1 << pprm->pble_shift" with type "int" (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "u64" (64 bits, unsigned).
2329     	bits_needed = (mem_size + (1 << pprm->pble_shift) - 1) >> pprm->pble_shift;
2330
2331     	spin_lock_irqsave(&pprm->prm_lock, flags);
2332     	while (chunk_entry != &pprm->clist) {
2333     		pchunk = (struct irdma_chunk *)chunk_entry;
2334     		bit_idx = bitmap_find_next_zero_area(pchunk->bitmapbuf,

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1505157 ("Integer handling issues")
Fixes: 915cc7ac0f8e ("RDMA/irdma: Add miscellaneous utility definitions")

Thanks for your attention!

-- 
Coverity-bot

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Coverity: irdma_prm_get_pbles(): Integer handling issues
  2021-06-08 18:01 Coverity: irdma_prm_get_pbles(): Integer handling issues coverity-bot
@ 2021-06-15 15:58 ` Saleem, Shiraz
  0 siblings, 0 replies; 2+ messages in thread
From: Saleem, Shiraz @ 2021-06-15 15:58 UTC (permalink / raw)
  To: coverity-bot, Ismail, Mustafa, Nikolova, Tatyana E
  Cc: Jason Gunthorpe, Gustavo A. R. Silva, linux-next

> Subject: Coverity: irdma_prm_get_pbles(): Integer handling issues
> 
> Hello!
> 
> This is an experimental semi-automated report about issues detected by Coverity
> from a scan of next-20210608 as part of the linux-next scan project:
> https://scan.coverity.com/projects/linux-next-weekly-scan
> 
> You're getting this email because you were associated with the identified lines of
> code (noted below) that were touched by commits:
> 
>   Wed Jun 2 19:55:19 2021 -0300
>     915cc7ac0f8e ("RDMA/irdma: Add miscellaneous utility definitions")
> 
> Coverity reported the following:
> 
> *** CID 1505157:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
> /drivers/infiniband/hw/irdma/utils.c: 2329 in irdma_prm_get_pbles()
> 2323     	struct list_head *chunk_entry = pprm->clist.next;
> 2324     	u32 offset;
> 2325     	unsigned long flags;
> 2326     	*vaddr = 0;
> 2327     	*fpm_addr = 0;
> 2328
> vvv     CID 1505157:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
> vvv     Potentially overflowing expression "1 << pprm->pble_shift" with type "int"
> (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context
> that expects an expression of type "u64" (64 bits, unsigned).
> 2329     	bits_needed = (mem_size + (1 << pprm->pble_shift) - 1) >> pprm-
> >pble_shift;
> 2330
> 2331     	spin_lock_irqsave(&pprm->prm_lock, flags);
> 2332     	while (chunk_entry != &pprm->clist) {
> 2333     		pchunk = (struct irdma_chunk *)chunk_entry;
> 2334     		bit_idx = bitmap_find_next_zero_area(pchunk->bitmapbuf,
> 
> If this is a false positive, please let us know so we can mark it as such, or teach
> the Coverity rules to be smarter. If not, please make sure fixes get into linux-next.
> :) For patches fixing this, please include these lines (but double-check the "Fixes"
> first):
> 
> Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
> Addresses-Coverity-ID: 1505157 ("Integer handling issues")
> Fixes: 915cc7ac0f8e ("RDMA/irdma: Add miscellaneous utility definitions")
> 
> Thanks for your attention!


This appears to be a bug. We will send a fix.

Shiraz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-15 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08 18:01 Coverity: irdma_prm_get_pbles(): Integer handling issues coverity-bot
2021-06-15 15:58 ` Saleem, Shiraz

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.