linux_dsm_epyc7002/drivers/infiniband/hw/bnxt_re
Dan Carpenter 97099cc652 RDMA/bnxt_re: fix a size calculation
This is from static analysis not from testing.  Depending on the value
of rcfw->cmdq_depth, then this might not cause an issue at runtime.

The BITS_TO_LONGS() macro tells us how many longs it take to hold a
bitmap.  In other words, it divides by the number if bits per long and
rounds up.  Then we want to take that number and multiple by
sizeof(long) to get the number of bytes to allocate.

The code here does the multiplication first so the rounding up is done
in the wrong place.  So imagine we want to allocate 1 bit, then
"(1 * 8) / 64 = 1" when we round up.  But it should be
"(1 / 64) * 8 = 8".  In other words, because of the rounding difference
we might allocate up to "sizeof(long) - 1" bytes fewer than intended.

Fixes: 1ac5a40479 ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-By: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2019-01-14 14:05:54 -07:00
..
bnxt_re.h RDMA/bnxt_re: Avoid resource leak in case the NQ registration fails 2018-10-16 00:03:51 -06:00
hw_counters.c RDMA/bnxt_re: Report out of sequence hw counters 2018-10-16 00:03:50 -06:00
hw_counters.h RDMA/bnxt_re: Report out of sequence hw counters 2018-10-16 00:03:50 -06:00
ib_verbs.c IB/{core,hw}: Have ib_umem_get extract the ib_ucontext from ib_udata 2019-01-10 17:07:45 -07:00
ib_verbs.h RDMA: Mark if destroy address handle is in a sleepable context 2018-12-19 16:28:03 -07:00
Kconfig bnxt_re: add MAY_USE_DEVLINK dependency 2017-07-29 14:17:48 -07:00
main.c RDMA: Introduce and use rdma_device_to_ibdev() 2019-01-14 13:12:03 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
qplib_fp.c RDMA/bnxt_re: Avoid accessing nq->bar_reg_iomem in failure case 2018-10-16 00:03:50 -06:00
qplib_fp.h RDMA/bnxt_re: Fix broken RoCE driver due to recent L2 driver changes 2018-05-25 11:03:47 -06:00
qplib_rcfw.c RDMA/bnxt_re: fix a size calculation 2019-01-14 14:05:54 -07:00
qplib_rcfw.h RDMA/bnxt_re: Increase depth of control path command queue 2018-12-19 16:37:33 -07:00
qplib_res.c RDMA/bnxt_re: QPLIB: Add and use #define dev_fmt(fmt) "QPLIB: " fmt 2018-09-05 15:35:20 -06:00
qplib_res.h RDMA/bnxt_re: Query HWRM Interface version from FW 2018-12-19 16:37:32 -07:00
qplib_sp.c infiniband: bnxt_re: qplib: Check the return value of send_message 2019-01-02 16:04:24 -07:00
qplib_sp.h RDMA/bnxt_re: Make use of destroy AH sleepable flag 2018-12-19 16:28:04 -07:00
roce_hsi.h RDMA/bnxt_re: Report out of sequence hw counters 2018-10-16 00:03:50 -06:00