Skip to content

Commit 4b105f4

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma fixes from Jason Gunthorpe: "I don't usually send a second PR in the merge window, but the fix to mlx5 is significant enough that it should start going through the process ASAP. Along with it comes some of the usual -rc stuff that would normally wait for a -rc2 or so. Summary: Important error case regression fixes in mlx5: - Wrong size used when computing the error path smaller allocation request leads to corruption - Confusing but ultimately harmless alignment mis-calculation Static checker warning fixes: - NULL pointer subtraction in qib - kcalloc in bnxt_re - Missing static on global variable in hfi1" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: IB/hfi1: make hist static RDMA/bnxt_re: Prefer kcalloc over open coded arithmetic IB/qib: Fix null pointer subtraction compiler warning RDMA/mlx5: Fix xlt_chunk_align calculation RDMA/mlx5: Fix number of allocated XLT entries
2 parents 0aa2516 + 2169b90 commit 4b105f4

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

drivers/infiniband/hw/bnxt_re/ib_verbs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,15 +1309,15 @@ static int bnxt_re_init_qp_attr(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd,
13091309
static int bnxt_re_create_shadow_gsi(struct bnxt_re_qp *qp,
13101310
struct bnxt_re_pd *pd)
13111311
{
1312-
struct bnxt_re_sqp_entries *sqp_tbl = NULL;
1312+
struct bnxt_re_sqp_entries *sqp_tbl;
13131313
struct bnxt_re_dev *rdev;
13141314
struct bnxt_re_qp *sqp;
13151315
struct bnxt_re_ah *sah;
13161316
int rc = 0;
13171317

13181318
rdev = qp->rdev;
13191319
/* Create a shadow QP to handle the QP1 traffic */
1320-
sqp_tbl = kzalloc(sizeof(*sqp_tbl) * BNXT_RE_MAX_GSI_SQP_ENTRIES,
1320+
sqp_tbl = kcalloc(BNXT_RE_MAX_GSI_SQP_ENTRIES, sizeof(*sqp_tbl),
13211321
GFP_KERNEL);
13221322
if (!sqp_tbl)
13231323
return -ENOMEM;

drivers/infiniband/hw/hfi1/trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ struct hfi1_ctxt_hist {
488488
atomic_t data[255];
489489
};
490490

491-
struct hfi1_ctxt_hist hist = {
491+
static struct hfi1_ctxt_hist hist = {
492492
.count = ATOMIC_INIT(0)
493493
};
494494

drivers/infiniband/hw/mlx5/mr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ static struct mlx5_ib_mr *alloc_cacheable_mr(struct ib_pd *pd,
995995
static void *mlx5_ib_alloc_xlt(size_t *nents, size_t ent_size, gfp_t gfp_mask)
996996
{
997997
const size_t xlt_chunk_align =
998-
MLX5_UMR_MTT_ALIGNMENT / sizeof(ent_size);
998+
MLX5_UMR_MTT_ALIGNMENT / ent_size;
999999
size_t size;
10001000
void *res = NULL;
10011001

@@ -1024,7 +1024,7 @@ static void *mlx5_ib_alloc_xlt(size_t *nents, size_t ent_size, gfp_t gfp_mask)
10241024

10251025
if (size > MLX5_SPARE_UMR_CHUNK) {
10261026
size = MLX5_SPARE_UMR_CHUNK;
1027-
*nents = get_order(size) / ent_size;
1027+
*nents = size / ent_size;
10281028
res = (void *)__get_free_pages(gfp_mask | __GFP_NOWARN,
10291029
get_order(size));
10301030
if (res)

drivers/infiniband/hw/qib/qib_sysfs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,11 @@ static ssize_t diagc_attr_store(struct ib_device *ibdev, u32 port_num,
403403
}
404404

405405
#define QIB_DIAGC_ATTR(N) \
406+
static_assert(&((struct qib_ibport *)0)->rvp.n_##N != (u64 *)NULL); \
406407
static struct qib_diagc_attr qib_diagc_attr_##N = { \
407408
.attr = __ATTR(N, 0664, diagc_attr_show, diagc_attr_store), \
408-
.counter = &((struct qib_ibport *)0)->rvp.n_##N - (u64 *)0, \
409+
.counter = \
410+
offsetof(struct qib_ibport, rvp.n_##N) / sizeof(u64) \
409411
}
410412

411413
QIB_DIAGC_ATTR(rc_resends);

0 commit comments

Comments
 (0)