> Subject: Coverity: irdma_reg_user_mr(): 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:18 2021 -0300 > b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs") > > Coverity reported the following: > > *** CID 1505149: Integer handling issues (DIVIDE_BY_ZERO) > /drivers/infiniband/hw/irdma/verbs.c: 2794 in irdma_reg_user_mr() > 2788 SZ_4K | SZ_2M | > SZ_1G, > 2789 virt); > 2790 iwmr->len = region->length; > 2791 iwpbl->user_base = virt; > 2792 palloc = &iwpbl->pble_alloc; > 2793 iwmr->type = req.reg_type; > vvv CID 1505149: Integer handling issues (DIVIDE_BY_ZERO) > vvv In function call "ib_umem_num_dma_blocks", division by expression "iwmr- > >page_size" which may be zero has undefined behavior. > 2794 iwmr->page_cnt = ib_umem_num_dma_blocks(region, iwmr- > >page_size); > 2795 > 2796 switch (req.reg_type) { > 2797 case IRDMA_MEMREG_TYPE_QP: > 2798 use_pbles = ((req.sq_pages + req.rq_pages) > 2); > 2799 err = irdma_handle_q_mem(iwdev, &req, iwpbl, > use_pbles); > > 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@xxxxxxxxxxxx> > Addresses-Coverity-ID: 1505149 ("Integer handling issues") > Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs") > > Thanks for your attention! > This appears to be a bug. We will send a fix. Shiraz